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

            Bug ID: 87415
           Summary: wrong code at -O1 and above on x86_64-linux-gnu
           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: ---

It 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 20180924 (experimental) [trunk revision 264537] (GCC) 
$ 
$ gcctk -O0 small.c; ./a.out
$ 
$ gcctk -O1 small.c
$ ./a.out
Segmentation fault (core dumped)
$ 


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


struct A
{
  int b:1;
};

int c[1], d;

int main ()
{
  struct A e = { 0 };
  if (!d)
    e.b = -1;
  if (!e.b)
    c[1000] = 0;
  return 0;
}

Reply via email to