-
Notifications
You must be signed in to change notification settings - Fork 11.5k
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
Invalid code generated by Powerpc64 -O1, -Oz #74915
Comments
Could you please clarify your issue? Is it a miscompilation? |
Invalid value output from optimization level -O1, -Oz. Normal output(O0, O2, O3, Os): 18446744073709551615 |
@llvm/issue-subscribers-backend-powerpc Author: godjhh (godjhh)
### Proof of Concepts
```
#include <stdint.h>
#include <stdio.h>
struct {
signed a;
} b = {-1L};
int32_t c;
uint64_t d;
uint8_t e[];
int32_t **h(int32_t **, int64_t);
static int32_t **f(uint32_t, int16_t);
int64_t g() {
int32_t *k = &b;
h(f((*k < 1) == *k, *k), *k);
}
int32_t **h(int32_t **, int64_t i) { d = i > 0 ^ i; }
int32_t **f(uint32_t l, int16_t j) {
if (j || (e[0] = 0), c || l | -1L <= j)
;
else
for (;;)
;
}
int main() {
g();
printf("%lu\n", d);
return 0;
}
```
godbolt link: https://www.godbolt.org/z/9xKG5Tac6 |
This seems like some kind of generated test case. Have you confirmed that it is free from UB? Also can you comment on what code/project this affects? |
Verified with -fsanitize=address and -fsanitize=undefined, the case is OK. The issue can be reproduced on AIX 64 with -mcpu=pwr8 or above. It is OK with -mcpu=pwr7. |
Sorry for the late. I posted #84419 for this miscompile |
Proof of Concepts
godbolt link: https://www.godbolt.org/z/9xKG5Tac6
The text was updated successfully, but these errors were encountered: