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
Miscompilation with -opaque-pointers=true with LLVM16 #4538
Comments
This might be a bug in LLVM16. Modified the testcase a little: static struct S
{
S* thisptr;
~this() {
assert(&this == thisptr);
thisptr = null;
}
}
void foo() {
S[] test14126 = new S[74];
foreach (ref s; test14126)
{
s.thisptr = &s;
}
import core.stdc.stdio; printf("%p\n", &test14126[$-1]);
import core.stdc.stdio; printf("%p\n", test14126[$-1].thisptr);
}
void main() {
foo();
} It bugs already in the printfs. LLVM16 --opaque-pointers=true: LLVM17 gives correct output I cannot find any fault in our outputted LLVM IR. Looks like a vectorization bug in LLVM16, because the optimized IR does look bad (writes same pointer to |
OMG. And the CI-tested LLVM 16 version is our LDC-LLVM, based on v16.0.6, the latest patch for the v16 family. Ouch, so much for the plan to use LLVM 16 + opaque pointers by default in LDC v1.36. :( |
FWIW, I've just pushed https://github.com/ldc-developers/llvm-project/tree/ldc-release/17.x (preliminary so far). |
Also seen with LLVM v15.0.6 on Linux x86_64: https://github.com/ldc-developers/ldc/actions/runs/9052573385/job/24870398659?pr=4657 |
Testcase from druntime
rt/lifetime.d
line 2686 miscompiles with-opaque-pointers=true -O
:(no need to add this testcase when the bug is fixed, because it is already part of the testsuite when opaque pointers are enabled)
The text was updated successfully, but these errors were encountered: