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

            Bug ID: 70160
           Summary: gcc ICE at -O2 (seg fault) and above on valid code on
                    x86_64-linux-gnu
           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 -O2 and above on x86_64-linux-gnu in 32-bit mode.

The 64-bit mode works fine. It should be a 6 regression.

$ 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 20160309 (experimental) [trunk revision 234083] (GCC)




$ gcc-trunk -c -O2 abc.c
$ gcc-trunk -c -O2 abc.c -m32
abc.c: In function 'fn2':
abc.c:19:1: internal compiler error: Segmentation fault
 }
 ^
0xb5a51f crash_signal
        ../../gcc/gcc/toplev.c:335
0xaf9d0b volatile_refs_p(rtx_def const*)
        ../../gcc/gcc/rtlanal.c:2555
0xaf9df1 volatile_refs_p(rtx_def const*)
        ../../gcc/gcc/rtlanal.c:2594
0x11d3c93 deletable_insn_p_1
        ../../gcc/gcc/dce.c:84
0x11d4e90 prescan_insns_for_dce
        ../../gcc/gcc/dce.c:639
0x11d5449 fast_dce
        ../../gcc/gcc/dce.c:1052
0x11d60e4 rest_of_handle_fast_dce
        ../../gcc/gcc/dce.c:1147
0x11d61f8 run_fast_df_dce()
        ../../gcc/gcc/dce.c:1195
0x7b57d8 df_lr_finalize
        ../../gcc/gcc/df-problems.c:1018
0x7ae2bd df_analyze_problem(dataflow*, bitmap_head*, int*, int)
        ../../gcc/gcc/df-core.c:1183
0x7ae378 df_analyze_1
        ../../gcc/gcc/df-core.c:1234
0x122c1da if_convert
        ../../gcc/gcc/ifcvt.c:5308
0x122de4d execute
        ../../gcc/gcc/ifcvt.c:5513
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
long long a;
void fn1();
void fn2(t, a_int, x0, p) unsigned t;
int a_int;
int x0;
unsigned p;
{
  long long x;
  int i, j = 1;
  t = i;
  for (; j;) {
    a = x;
    x = 1 + t;
    j += a_int;
    fn1();
    if (x == 1)
      return;
  }
}

Reply via email to