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

            Bug ID: 86034
           Summary: wrong code at -Os on x86-64-linux-gnu in 64-bit mode
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu
  Target Milestone: ---

This appears to be a recent regression. 


$ gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/home/su/software/tmp/gcc/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/home/su/software/tmp/gcc/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 9.0.0 20180602 (experimental) [trunk revision 261116] (GCC) 
$ 
$ gcctk -O1 small.c; ./a.out
$ 
$ gcctk -Os small.c
$ ./a.out
Aborted (core dumped)
$ 


-----------------------------------


struct A
{
  int b;
  int c:24;
  int d:10;
  int e;
} f;

int g; 

void h ()
{
  struct A i = { 0, 0, -1, 0 };
L:
  f = i;
  i.d = 0;
  if (g < 0)
    goto L;
}

int main ()
{
  h ();
  if (f.e != 0) 
    __builtin_abort ();
  return 0; 
}

Reply via email to