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

            Bug ID: 126743
           Summary: If a != b, then (a | b) (==,!=) 0 -> (false, true)
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kaelfandrew at gmail dot com
  Target Milestone: ---

https://godbolt.org/z/Y6Y9Ps3GE

With GCC trunk -O2:

```
_Bool
or_eq_zero (int a, int b)
{
  if (a == b)
    __builtin_unreachable ();
  // return 0;
  return (a | b) == 0;
}

_Bool
or_ne_zero (int a, int b)
{
  if (a == b)
    __builtin_unreachable ();
  // return 1;
  return (a | b) != 0;
}
```

Noticed from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117760#c11

Reply via email to