- Notifications
You must be signed in to change notification settings - Fork 15.3k
Closed
Labels
Description
Clang at -Os produced the wrong code.
Bisected to 6ed152a, which was committed by @caojoshua
Compiler explorer: https://godbolt.org/z/aMEWqd9dP
% cat a.c int printf(const char *, ...); int a, b, c; long d; const unsigned *e; const unsigned **f[3]; static char(g)(unsigned h, int j) { return h > j ? h : h << j; } static short k() { char l = 1; b = 0; for (; b <= 3; b++) { char *m = &l; int *n = &c; int i = 0; for (; i < 3; i++) f[i] = &e; *n = g((*m)--, 7); if (*n) ; else { for (; i < 9; i++) f[0] || (d = 2); if (0 < *n) ; else return 0; } printf("%d\n", *n); } return 1; } int main() { k(); } % % clang -O0 a.c && ./a.out -128 0 % clang -Os a.c && ./a.out -128 0 -128 0 %