Skip to content

Wrong code at -O1 and above on x86_64-linux_gnu(recent regression) #76162

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

Closed
shao-hua-li opened this issue Dec 21, 2023 · 2 comments
Closed

Wrong code at -O1 and above on x86_64-linux_gnu(recent regression) #76162

shao-hua-li opened this issue Dec 21, 2023 · 2 comments

Comments

@shao-hua-li
Copy link

Clang at -O1 and above produces the wrong code.

Bisected to 8773c9b, which was committed by @mgudim

Compiler explorer: https://godbolt.org/z/aTKK3Prqs

% cat reduced.c
int printf(const char *, ...);
int a, b = 7, c;
int *d = &c;
int e() { return 1 & b; }
int main() {
  char f = -1;
  *d = a + f == e() + f + f;
  printf("%d\n", c);
}
%
% clang -O0 reduced.c && ./a.out
1
% clang -O1 reduced.c && ./a.out
0
%
@mgudim
Copy link
Contributor

mgudim commented Dec 21, 2023

I will look into this. The offending commit was reverted: #76167

@mgudim mgudim self-assigned this Dec 21, 2023
@mgudim
Copy link
Contributor

mgudim commented Jan 3, 2024

This was fixed in #76531

@mgudim mgudim closed this as completed Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants