-
-
Notifications
You must be signed in to change notification settings - Fork 262
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
LDC crashes deep in LLVM #4759
Comments
Reduced testcase: auto setCallback(alias F)() {
return __traits(identifier, __traits(parent, F));
}
void foo()
{
static void closure(void delegate() ) {}
closure({
static f() {}
setCallback!f;
});
}
Line 603 in 4220a1b
|
Hint towards the issue: auto setCallback(alias F)() {
auto a = __traits(parent, F);
}
void closure(void delegate() ) {}
void foo()
{
closure({
static f() {}
setCallback!f;
});
}
|
Reduced testcase: void closure(void delegate() ) {}
void foo()
{
closure({
static f() {}
auto a = __traits(parent, f); // Error: forward reference to inferred return type of function call `__lambda1()`
auto a = __traits(identifier, __traits(parent, f)); // --> crash
});
} |
Yeah thanks for the report, we're hitting assertions earlier, related to the dark corners around |
My reduced test case. Thanks @kinke
|
Thanks for the reduced examples! I'm really new to D, so I have some noob questions. Do I understand it correctly that:
BTW, I believe |
Last time I talked with compiler frontend people, at Dconf, I suggested an optional glue code coherency checker of the AST, which is something I have planned to add as a compiler plugin, so we can detect possible incoherent state like uncaught forward references, attributes inference mismatch, alongside other checks that might be expensive to run by default, but worth running in a compiler debugging session. It would be a complete AST traversal with additional checks, after semantics, pretty much.
Yeah, DMD backend is a toy to me, I wouldn't trust the codegen of DMD backend for anything in production. There's many situations where DMD goes happy and the user goes mad. |
I see a crash trying to compile this code (already minified by dustmite):
Compile command:
ldc2 -c crash.d --unittest
.Stack trace:
The problem goes away if I move
static f() {}
definition out of the function body.Checked on Ubuntu with
and on M3 Mac with
Though on Mac I have to pass
--mtripple=x86_64-pc-linux-gnu
to trigger the crash.The text was updated successfully, but these errors were encountered: