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

            Bug ID: 64495
           Summary: ICE at -O3 for trunk and wrong code for 4.8/4.9 on
                    x86_64-linux-gnu
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

This is an almost identical test as the one for PR 64493: 

(1) Like PR 64493, the code causes an ICE when compiled with the current gcc
trunk at -O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes; and 

(2) it is also miscompiled at -O3 by 4.8.x and 4.9.x (thus a regression from
4.7.x). 

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 5.0.0 20150104 (experimental) [trunk revision 219172] (GCC) 

$ 
$ gcc-trunk -O3 small.c
small.c: In function ‘main’:
small.c:7:1: error: definition in block 33 does not dominate use in block 31
 main ()
 ^
for SSA_NAME: vect_d.30_19 in statement:
vect__32.36_66 = vect_d.30_19 | vect__32.36_39;
small.c:7:1: internal compiler error: verify_ssa failed
0xc8c6b1 verify_ssa(bool, bool)
    ../../gcc-trunk/gcc/tree-ssa.c:1062
0x9daae5 execute_function_todo
    ../../gcc-trunk/gcc/passes.c:1947
0x9db523 execute_todo
    ../../gcc-trunk/gcc/passes.c:1997
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
$ 
$ gcc-4.7 -O3 small.c; a.out
$ gcc-4.8 -O2 small.c; a.out
$ gcc-4.9 -O2 small.c; a.out
$ 
$ gcc-4.8 -O3 small.c; a.out
Aborted (core dumped)
$ gcc-4.9 -O3 small.c; a.out
Aborted (core dumped)
$ 


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


#include <assert.h>

int a, b, c, d, e, f, g, i, j;
static int *h = &e;

int
main ()
{
  for (; a;)
    for (; g; g++)
      for (; f; f++)
    if (j)
      {
        assert(b); 
        assert(0);
      }
  for (i = 24; i; i--)
    {
      for (c = 0; c < 6; c++)
    d |= 1;
      *h |= d;
    }

  if (e != 1) 
    __builtin_abort (); 

  return 0;
}

Reply via email to