https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118638

--- Comment #1 from Yunbo Ni <yunboni at smail dot nju.edu.cn> ---
(In reply to Yunbo Ni from comment #0)
> This code prints -1 at -O0/1/2/3 and 3 at -Os:
> 
> ```c
> int printf(const char *, ...);
> int a;
> int b(int f) {
>   int c = f ? 1 : 0, d = f ? 1 : 0, e = f ? 1 : 0;
>   return c + d + e;
> }
> int g() {
>   if (!((b(a + 3) + (a - 9 + a)) & 1))
>     return -1;
>   return 0;
> }
> int main() {
>   int h = g();
>   printf("%X\n", h);
> }
> ```
> 
> Compiler Explorer: https://godbolt.org/z/fa3qP15d3
> 
> It starts with x86-64 gcc 14.1.

Line 14 should be printf("%d\n", h); otherwise it prints FFFFFFFF at -O0/1/2/3.

Reply via email to