[Bug middle-end/126742] New: Wrong code for a != b | (a|b) != 0

"kristerw at gcc dot gnu.org via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126742

            Bug ID: 126742
           Summary: Wrong code for a != b | (a|b) != 0
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kristerw at gcc dot gnu.org
            Blocks: 118443
  Target Milestone: ---

The test below fails when compiled for x86_64 with -O1:

unsigned f(unsigned a, unsigned b)
{
  unsigned c = a != b;
  unsigned d = (a|b) != 0;
  return c | d;
}

int main()
{
  if (!f(1, 1))
    __builtin_abort();
  return 0;
}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118443
[Bug 118443] [Meta bug] Bugs triggered by and blocking more smtgcc testing
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.