-
-
Notifications
You must be signed in to change notification settings - Fork 608
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
Fix Issue 24246 - This eliminates the ICE, stopping the bleed, but do… #15818
Conversation
|
Thanks for your pull request, @maxhaton! Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "stable + dmd#15818" |
| error(e.loc, "CTFE internal error: literal `%s`", e.toChars()); | ||
| assert(0); | ||
| error(e.loc, "CTFE internal error: literal `%s` could not be copied.", e.toChars()); | ||
| return UnionExp(CTFEExp.cantexp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use fatal() instead.
dmd/compiler/src/dmd/cppmangle.d
Line 486 in 8c84af8
| .error(ti.loc, "%s `%s` internal compiler error: C++ `%s` template value parameter is not supported", ti.kind, ti.toPrettyChars, tv.valType.toChars()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it should be completely fatal while it triggers so easily
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It took years to find it. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The one I linked is trivial to hit as well. Mix any D type (arrays) with extern C++.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it realistic to recover from that in an IsExp (say)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an internal error, you're not meant to be able to recover.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear, this ICE is a result of a failure of semantic to analyse condexps properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its effectively a type check done way too late is my thinking. It should be fatal when the code actuall works but its not CondExps as much as a vast surface area of the type checking being totally bogus.
…es not fix the underlying issue in that the type checking is faulty.
|
|
||
| auto f24246(int i) | ||
| { | ||
| return true ? int : i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When does a primary exp such as int is accepted since ?
It is like https://issues.dlang.org/show_bug.cgi?id=24229.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
INitially that comes from an alias presumably ? IdentExp -> AliasDecl -> TypeExp ? Even if apparently it is also accepted as-is.
|
I don't see the point in merging this. The |
Currently the assert(0) just makes the compiler blow up without even an ICE message. It's a bit lazy. It should not be reachable at all, by construction, it's the type checker that's broken. Fixing that will not be particularly trivial, this effectively steps in as a bit of post-hoc type checking. The fact that it says internal error has been maintained but is honestly kind of meaningless. |
|
@maxhaton That's preferable because turning it into an error will make it liable to error gagging. Consider the case where the problematic code is triggered from a That's why I think that we should leave the assert as is until we fix the issue. Turning it into an error really doesn't buy as anything, whereas the assertion will make users submit bug reports with cases that we need to fix. |
…es not fix the underlying issue in that the type checking is faulty.