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

            Bug ID: 70169
           Summary: ICE at -O1 and above on x86_64-linux-gnu in
                    gen_lsm_tmp_name, at tree-ssa-loop.c:791
           Product: gcc
           Version: 6.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: ---

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

It also affects at least 4.6.x and after: 
- 4.6.x and 4.7.x hang 
- 4.8.x and later ICE

$ 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/6.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 6.0.0 20160310 (experimental) [trunk revision 234104] (GCC) 
$ 
$ gcc-trunk -O0 -c small.c
$  
$ gcc-trunk -O1 -c small.c
small.c: In function ‘fn1’:
small.c:4:1: internal compiler error: in gen_lsm_tmp_name, at
tree-ssa-loop.c:791
 fn1 ()
 ^~~
0xcdb56b gen_lsm_tmp_name
        ../../gcc-source-trunk/gcc/tree-ssa-loop.c:791
0xcdb610 gen_lsm_tmp_name
        ../../gcc-source-trunk/gcc/tree-ssa-loop.c:731
0xcdc275 get_lsm_tmp_name(tree_node*, unsigned int, char const*)
        ../../gcc-source-trunk/gcc/tree-ssa-loop.c:805
0xca5d7c execute_sm
        ../../gcc-source-trunk/gcc/tree-ssa-loop-im.c:1957
0xca5d7c hoist_memory_references
        ../../gcc-source-trunk/gcc/tree-ssa-loop-im.c:2021
0xca5d7c store_motion_loop
        ../../gcc-source-trunk/gcc/tree-ssa-loop-im.c:2295
0xca795a store_motion
        ../../gcc-source-trunk/gcc/tree-ssa-loop-im.c:2316
0xca795a tree_ssa_lim
        ../../gcc-source-trunk/gcc/tree-ssa-loop-im.c:2530
0xca795a execute
        ../../gcc-source-trunk/gcc/tree-ssa-loop-im.c:2580
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 printf (const char *, ...); 

void
fn1 ()
{
  int *p = (int *) &printf; 
  for (;;)
    (*p)++;
}

Reply via email to