http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59102

            Bug ID: 59102
           Summary: ICE on valid code at -Os and above on x86_64-linux-gnu
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: su at cs dot ucdavis.edu

The following code causes an ICE when compiled with the current gcc trunk at
-Os and above on x86_64-linux-gnu (in both 32-bit and 64-bit modes). 

This is a regression from 4.8.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/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --enable-languages=c,c++,fortran,lto
--disable-werror --with-gmp=/usr/local/gcc-trunk
--with-mpfr=/usr/local/gcc-trunk --with-mpc=/usr/local/gcc-trunk
--with-cloog=/usr/local/gcc-trunk --prefix=/usr/local/gcc-trunk
Thread model: posix
gcc version 4.9.0 20131112 (experimental) [trunk revision 204721] (GCC) 
$ 
$ gcc-trunk -O1 small.c; a.out
$ gcc-4.8.2 -Os small.c; a.out
$
$ gcc-trunk -Os small.c    
small.c: In function ‘main’:
small.c:16:1: internal compiler error: gimple check: expected
gimple_assign(error_mark), have gimple_call() in gimple_assign_lhs, at
gimple.h:1774
 main ()
 ^
0x7bafab gimple_check_failed
    ../../gcc-trunk/gcc/gimple.c:1139
0x51c805 gimple_assign_lhs
    ../../gcc-trunk/gcc/gimple.h:1774
0xe28b58 gimple_assign_lhs
    ../../gcc-trunk/gcc/gimple.h:1774
0xe28b58 insert_trap_and_remove_trailing_statements
    ../../gcc-trunk/gcc/gimple-ssa-isolate-paths.c:73
0xe29861 gimple_ssa_isolate_erroneous_paths
    ../../gcc-trunk/gcc/gimple-ssa-isolate-paths.c:300
0xe29861 execute
    ../../gcc-trunk/gcc/gimple-ssa-isolate-paths.c:365
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.
$ 


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


int a, b, c, f;

struct S
{
  int f0;
} d, *e;

struct S
foo ()
{
  b = c = b || a == 0 || f % 11;
  return d;
}

int
main ()
{
  foo ();
  if (b);
  else
    {
      struct S **g = &e;
      *g = 0;
      *e = foo ();
    }
  return 0;
}

Reply via email to