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

--- Comment #3 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Vineet Gupta from comment #2)
> While the changes above fix the argument promotion in caller, it seems to
> regress the return value promotion in caller (which was already happening,
> but not anymore for some cases).
> 
> _Bool bar_bool(void);
> int foo_bool_ne1(void) {
>       if (bar_bool() != 1) return 0; else return 1;
> }
> 
> -O2
> 
> W/ patch (NOK)         |   w/o patch (OK)
>                        |
> foo_bool_ne1:          | foo_bool_ne1:   
>    call    bar_bool    |   call    bar_bool
>    exit                |   r0 &= 0xff
>                        |   exit    
> 
> Weirdly this works for char, and even for bool case above with != 0
> 
> _Bool bar_bool(void);
> int foo_bool_ne0(void) {
>       if (bar_bool() != 0) return 0; else return 1;
> }
> 
> foo_bool_ne0:
>       call    bar_bool
>       w0 ^= 1
>       r0 &= 0xff
>       exit
> 
> Currently debugging this.

Hasn't the return value of callee, bar_bool, been promoted already?

Reply via email to