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

            Bug ID: 69932
           Summary: gcc ICE at -O1 and above on valid code on
                    x86_64-linux-gnu with “seg fault”
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: helloqirun at gmail dot com
  Target Milestone: ---

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


$ gcc-trunk  -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 6.0.0 20160223 (experimental) [trunk revision 233632] (GCC) 



$ gcc-trunk abc.c -c -O3
abc.c: In function ‘fn1’:
abc.c:8:1: internal compiler error: Segmentation fault
 }
 ^
0xb5ea1f crash_signal
        ../../gcc/gcc/toplev.c:335
0xbacab3 get_ref_base_and_extent(tree_node*, long*, long*, long*, bool*)
        ../../gcc/gcc/tree-dfa.c:392
0xc442da get_access_for_expr
        ../../gcc/gcc/tree-sra.c:2903
0xc4a97b sra_modify_assign
        ../../gcc/gcc/tree-sra.c:3314
0xc4a97b sra_modify_function_body
        ../../gcc/gcc/tree-sra.c:3621
0xc4a97b perform_intra_sra
        ../../gcc/gcc/tree-sra.c:3731
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.


$ cat abc.c
int a;
void fn1() {
  int b = 4;
  short c[4];
  c[b] = c[a];
  if (c[2]) {}

}

Reply via email to