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

            Bug ID: 77653
           Summary: wrong code at -Os and above on x86_64-linux-gnu (in
                    both 32-bit and 64-bit modes)
           Product: gcc
           Version: 7.0
            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 is a regression from 6.2.x.


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160919 (experimental) [trunk revision 240229] (GCC) 
$ 
$ gcc-6.2 -Os small.c; ./a.out
$ gcc-trunk -O1 small.c; ./a.out
$ 
$ gcc-trunk -Os small.c
$ ./a.out
Aborted (core dumped)
$ 


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


int a, b, c, d, e, h, i, j, k, l;
const int f; 
static int g;

void fn1 (int p1)
{
  k = d ? c % k : a * b;
  h &= j ^ i ^ 1;
}

int main ()
{
  const int *m = &f, **n = &m;
  l && (*n = &e);
  if (m != &f)
    __builtin_abort ();
  fn1 (g);
  return 0;
}

Reply via email to