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

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2025-11-03
     Ever confirmed|0                           |1

--- Comment #3 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Confirmed.  This appears to be a premature mis-optimization applied by the
language parser, since we get

return <retval> = x & 2147483646 | 2147483648;

as the starting point for optimizing.

Changing the source to:

unsigned int test1 (unsigned int x) {
    x &= 0xFFFFFFFE;
    return x | 0x80000000;
}

Gets the desired output.

Reply via email to