Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[REG2.066a] Issue 12574 - [ICE](statement.c, line 713) with reduce with wrong tuple arity #3454

Merged
merged 4 commits into from Apr 15, 2014

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Apr 15, 2014

https://issues.dlang.org/show_bug.cgi?id=12574

It's caused by wrong ErrorExp escaping from gagged period. I'm planning to make Expression::trySemantic more robust, but at least this is enough to fix the issue.

if (e->op != TOKdotvar)
return true;

/* Template instantiations involving a DotVar expression are difficult.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because it was between two TemplateInstance::semanticTiargss.

… tuple arity

Make `TemplateInstance::semanticTiargs` reentrant against semantic errors.
…t + alias this

Make AssignExp::semantic reentrant for `op_overload` call.

-----

If an expression supports operator overloading, its `semantic` function should not store error expressions in itself until the point of `op_olverload` call (from [a] to [b]).

Example:

Expression *XXXExp::semantic(Scope sc)
{
  // [a]
    ...
    e1 = e1->semantic(sc);  // Bad: if semantic analysis returns ErrorExp,
                            // it is stored in this->e1 immediately.
    if (e1->op == TOKerror)
        return e1;

  // [b]
    Expression *e = op_overload(sc);
    if (e)
        return e;
    ...
}

If `XXXExp::semantic` is called from the `trySemantic` call for `alias this` analysis (from `op_overload` function in `opover.c`), the stored ErrorExp would accidentally escape from the gagged period.
@9rnsr
Copy link
Contributor Author

9rnsr commented Apr 15, 2014

Add fix for issue 12581.

@WalterBright
Copy link
Member

Auto-merge toggled on

WalterBright added a commit that referenced this pull request Apr 15, 2014
[REG2.066a] Issue 12574 - [ICE](statement.c, line 713) with reduce with wrong tuple arity
@WalterBright WalterBright merged commit bbd174c into dlang:master Apr 15, 2014
@9rnsr 9rnsr deleted the fix12501 branch April 15, 2014 22:54
@9rnsr
Copy link
Contributor Author

9rnsr commented Apr 15, 2014

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants