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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I will have a look.  Note that we fold this to

  c = (char) ((unsigned char) d >> 254)

early.  Huh.

With optimization we optimize it to c = 0.

unsigned char a = 5, c;
unsigned short b = 0;
unsigned d = 0x76543210;
void __attribute__((noinline))
fn1() { c = d >> ~(a || ~b); }

int main()
{
  fn1();
  if (c != 1)
    __builtin_abort ();
  return 0;
}

Reply via email to