-
Notifications
You must be signed in to change notification settings - Fork 13.4k
wrong code at -O1/-O2 on x86_64-linux-gnu #95630
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
Comments
|
Third loops seems to be such. |
I believe this code has UB as |
I guess you are using creduce. If you think the original case doesn't contain UB, can you share the code? |
Thanks for your reply! Please consider the following code: int printf(const char *, ...);
int b, c, g, i;
long *d, *h;
int main() {
long j;
c = 0;
for (; c <1; ++c) {
long k;
long **l = &d;
for (; i<1; i++)
h = &k;
g = h != (*l = &j);
int *m = &b;
*m = g;
}
printf("%d\n", b);
}
> clang -O2 s.c; ./a.out
0
> clang -O0 s.c; a.out
1 |
bisected to StackColoring.
|
As stack slots |
This issue is fixed after I swapped |
This sounds like the same issue as #45725, which is hard to fix. I assume this is fuzzer-generated? |
I guess so. |
Closing this as a duplicate of the issue mentioned above. |
Compiler explorer: https://godbolt.org/z/PP5eaEccb
Clang-18 produces the wrong code when compiling the following code with "-O1" or "-O2", while outputting the correct result with the optimization flag "-O3".
The text was updated successfully, but these errors were encountered: