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

            Bug ID: 92529
           Summary: [10 Regression] Wrong code with ICF since r278207
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Following is miscompiled:

$ cat icf1.c
int
foo(volatile int a)
{
  return (char)a;
}

int
bar(volatile int a)
{
  return (short)a;
}

#pragma GCC optimize ("-O0")

int main(int argc, char **argv)
{
  int r = bar(1000);
  __builtin_printf ("global: %d\n", r);
  if (r != 1000)
    __builtin_abort ();

  return 0;
}

$ gcc icf1.c -O2 && ./a.out 
global: -24
Aborted (core dumped)

Reply via email to