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

            Bug ID: 80025
           Summary: [5/6/7 Regression] ICE w/ -O2 (-O3, -Ofast) -g
                    -ftracer (infinite recursion in
                    rtx_equal_for_cselib_1)
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---
            Target: x86_64-pc-linux-gnu

gcc 5, 6, and the current trunk (the gcc-7.0.0-alpha20170312 snapshot) all ICE
when compiling the following snippet w/ -O2 (or -O3, -Ofast) -g -ftracer due to
infinite recursion in rtx_equal_for_cselib_1:

int kq;
long int cs, l3;

long int
gn (void)
{
}

void
yc (int un, short int z6, unsigned short int il)
{
  (void)un;
  (void)z6;
  (void)il;
}

int
w6 (void)
{
  kq -= cs;
  cs = !gn ();
  yc (cs ^= (l3 ^ 1) ? (l3 ^ 1) : gn (), &yc, kq);
}

% x86_64-pc-linux-gnu-gcc-7.0.0-alpha20170312 -O2 -g -ftracer -w -c bxvehker.c
x86_64-pc-linux-gnu-gcc-7.0.0-alpha20170312: internal compiler error:
Segmentation fault (program cc1)

Reduced backtrace:

Program received signal SIGSEGV, Segmentation fault.
0x00000000007682e2 in rtx_equal_for_cselib_1(rtx_def*, rtx_def*, machine_mode)
()
(gdb) where 10
#0  0x00000000007682e2 in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
#1  0x0000000000768523 in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
#2  0x00000000007688f0 in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
#3  0x00000000007684ab in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
#4  0x00000000007686ba in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
#5  0x0000000000768523 in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
#6  0x00000000007686ba in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
#7  0x00000000007684ab in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
#8  0x00000000007686ba in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
#9  0x0000000000768523 in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
(More stack frames follow...)
(gdb) where -25
#599034 0x00000000007684ab in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
#599035 0x00000000007686ba in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
#599036 0x0000000000768523 in rtx_equal_for_cselib_1(rtx_def*, rtx_def*,
machine_mode) ()
#599037 0x000000000076bbbe in hash_table<cselib_hasher,
xcallocator>::find_slot_with_hash(cselib_hasher::key* const&, unsigned int,
insert_option) ()
#599038 0x0000000000764c39 in cselib_find_slot(machine_mode, rtx_def*, unsigned
int, insert_option, machine_mode) ()
#599039 0x0000000000764ced in cselib_lookup(rtx_def*, machine_mode, int,
machine_mode) ()
#599040 0x0000000000768fae in cselib_add_permanent_equiv(cselib_val*, rtx_def*,
rtx_insn*) ()
#599041 0x0000000000e533ae in add_stores(rtx_def*, rtx_def const*, void*) ()
#599042 0x0000000000afafc1 in note_stores(rtx_def const*, void (*)(rtx_def*,
rtx_def const*, void*), void*) ()
#599043 0x0000000000e4d88b in add_with_sets(rtx_insn*, cselib_set*, int) ()
#599044 0x0000000000769924 in cselib_record_sets(rtx_insn*) ()
#599045 0x000000000076b02f in cselib_process_insn(rtx_insn*) ()
#599046 0x0000000000e6102a in vt_initialize() ()
#599047 0x0000000000e635f3 in (anonymous
namespace)::pass_variable_tracking::execute(function*) ()
#599048 0x0000000000a88001 in execute_one_pass(opt_pass*) ()
#599049 0x0000000000a888d1 in execute_pass_list_1(opt_pass*) ()
#599050 0x0000000000a888e3 in execute_pass_list_1(opt_pass*) ()
#599051 0x0000000000a888e3 in execute_pass_list_1(opt_pass*) ()
#599052 0x0000000000a88925 in execute_pass_list(function*, opt_pass*) ()
#599053 0x000000000074dc53 in cgraph_node::expand() ()
#599054 0x000000000074f37a in symbol_table::compile() [clone .part.51] ()
#599055 0x0000000000751a87 in symbol_table::finalize_compilation_unit() ()
#599056 0x0000000000b664a5 in compile_file() ()
#599057 0x00000000005a5e67 in toplev::main(int, char**) ()
#599058 0x00000000005a820b in main ()

Reply via email to