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

            Bug ID: 122925
           Summary: sh: function is miscompiled
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kristerw at gcc dot gnu.org
            Blocks: 118443
  Target Milestone: ---
            Target: sh-elf

The program below is miscompiled by sh-elf-gcc when built with -O1 or higher.


#include <stdint.h>

__attribute__ ((noipa)) int
foo(uint32_t a, uint16_t b) {
  uint64_t c = (b ^ -4);
  if (1 - c >= b)
    a = 100;
  return a;
}

int main(void)
{
  if (foo(0, -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

Reply via email to