gcc-8.0.0-alpha20171217 snapshot (r255766) ICEs when compiling the following snippet w/ -g -O2 (-O3, -Ofast) -fselective-scheduling2 -fsel-sched-pipelining -fgcse-sm -floop-parallelize-all -fno-tree-loop-im: int cf, eq; void m8 (long long int yl, int nn) { while (nn < 1) { cf = (yl / nn) >= -1; ++nn; } while (cf < 1) { for (eq = 0; eq < 2; eq++) { } ++cf; } } % powerpc-e300c3-linux-gnu-gcc-8.0.0-alpha20171217 -g -O2 -fselective-scheduling2 -fsel-sched-pipelining -fgcse-sm -floop-parallelize-all -fno-tree-loop-im -c m4vfwtte.c during RTL pass: sched2 m4vfwtte.c: In function 'm8': m4vfwtte.c:19:1: internal compiler error: in create_block_for_bookkeeping, at sel-sched.c:4557 } ^ 0xbe4c22 create_block_for_bookkeeping /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:4557 0xbe4c22 find_place_for_bookkeeping /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:4694 0xbe4c22 generate_bookkeeping_insn /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:4794 0xbe4c22 move_op_at_first_insn /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:6067 0xbe551b code_motion_path_driver /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:6659 0xbe5f01 code_motion_process_successors /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:6346 0xbe5f01 code_motion_path_driver /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:6612 0xbe5f01 code_motion_process_successors /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:6346 0xbe5f01 code_motion_path_driver /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:6612 0xbe6765 move_op /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:6704 0xbe6765 move_exprs_to_boundary /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:5227 0xbe6765 schedule_expr_on_boundary /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:5440 0xbea7c8 fill_insns /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:5582 0xbec53e schedule_on_fences /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:7356 0xbec53e sel_sched_region_2 /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:7494 0xbeed31 sel_sched_region_1 /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:7536 0xbeed31 sel_sched_region(int) /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:7637 0xbef401 run_selective_scheduling() /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sel-sched.c:7713 0xbc640d rest_of_handle_sched2 /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sched-rgn.c:3729 0xbc640d execute /var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-8.0.0_alpha20171217/work/gcc-8-20171217/gcc/sched-rgn.c:3873
Confirmed on gcc110 with: ~/src/gcc/configure --disable-bootstrap --disable-multilib --enable-languages=c --with-isl=$HOME/bld/isl-0.15/install ... ... LD_LIBRARY_PATH=~/bld/isl-0.15/install/lib/ ./cc1 a.c -quiet -g -O2 -fselective-scheduling2 -fsel-sched-pipelining -fgcse-sm -floop-parallelize-all -fno-tree-loop-im -m32
This is not target-specific. The following snippet compiled w/ -g -O2 (-O3, -Ofast) -fselective-scheduling2 -ftree-vectorize -freorder-blocks-algorithm=simple -fnon-call-exceptions -fno-guess-branch-probability -fno-peephole2 -fno-tree-sink -fno-tree-scev-cprop reproduces the issue for x86_64: signed char jx, dl; void m9 (int zk, int f9) { for (jx = 1; jx != 0; ++jx) { } for (;;) { int wj; dl %= (f9 != 0 && jx != 0) + 1; if (jx != 0) f9 = dl; for (wj = 0; wj < 50; ++wj) ++zk; if (jx < 1) { while (zk != 0) { } jx /= 0; } } }
Likely a duplicate of PR80463.
Started with r255607 (at least the #c2 testcase).
The ICE goes away with -gno-statement-frontiers, perhaps if sel-sched is unfixable we should disable statement frontiers in addition to var-tracking-assignments that we already disable for sel-sched.
It seems like sel-sched really can't deal with debug insns; I agree it makes sense to disable all sorts of debug insns when sel-sched is selected/enabled.
Apparently we only disable -fvar-tracking-assignments by default if sel-sched, not disable it unconditionally. So, while we could and should change: if (debug_nonbind_markers_p == AUTODETECT_VALUE) debug_nonbind_markers_p = optimize && debug_info_level >= DINFO_LEVEL_NORMAL && (write_symbols == DWARF2_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG); to if (debug_nonbind_markers_p == AUTODETECT_VALUE) debug_nonbind_markers_p = (optimize && debug_info_level >= DINFO_LEVEL_NORMAL && (write_symbols == DWARF2_DEBUG || write_symbols == VMS_AND_DWARF2_DEBUG) && !(flag_selective_scheduling || flag_selective_scheduling2)); the testcase would still ICE with -gstatement-frontiers.
Created attachment 43045 [details] gcc8-pr83480.patch In any case, I think this patch is a small step towards the right direction.
didn't we print a warning if we found VTA and sel-sched enabled at the same time, too? I guess that might be useful in this case as well. (thanks for taking care of this!)
Author: jakub Date: Sat Jan 6 07:48:31 2018 New Revision: 256309 URL: https://gcc.gnu.org/viewcvs?rev=256309&root=gcc&view=rev Log: PR debug/83480 * toplev.c (process_options): Don't enable debug_nonbind_markers_p by default if flag_selective_schedling{,2}. Formatting fixes. * gcc.dg/pr83480.c: New test. Added: trunk/gcc/testsuite/gcc.dg/pr83480.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/toplev.c
Not fully fixed yet, the testcase still ICEs with: -O2 -g -gstatement-frontiers -fselective-scheduling2 -fsel-sched-pipelining -fgcse-sm -floop-parallelize-all -fno-tree-loop-im
(In reply to Jakub Jelinek from comment #11) > Not fully fixed yet, the testcase still ICEs with: > -O2 -g -gstatement-frontiers -fselective-scheduling2 -fsel-sched-pipelining > -fgcse-sm -floop-parallelize-all -fno-tree-loop-im I couldn't make testcase from #c2 to ICE with those, so I've checked out the reported rev. 255766 and reproduced the ICE from that comment. That one is fixed with the same patch as for PR 80463 #c3 and PR 83972.
It's no longer a regression now since -gstatement-frontiers is new and now required to trigger the ICE.
Author: abel Date: Mon Apr 9 10:19:50 2018 New Revision: 259231 URL: https://gcc.gnu.org/viewcvs?rev=259231&root=gcc&view=rev Log: PR rtl-optimization/80463 PR rtl-optimization/83972 PR rtl-optimization/83480 * sel-sched-ir.c (has_dependence_note_mem_dep): Take into account the correct producer for the insn. (tidy_control_flow): Fixup seqnos in case of debug insns. * gcc.dg/pr80463.c: New test. * g++.dg/pr80463.C: Likewise. * gcc.dg/pr83972.c: Likewise. Added: trunk/gcc/testsuite/g++.dg/pr80463.C trunk/gcc/testsuite/gcc.dg/pr80463.c trunk/gcc/testsuite/gcc.dg/pr83972.c Modified: trunk/gcc/ChangeLog trunk/gcc/sel-sched-ir.c trunk/gcc/testsuite/ChangeLog
Fixed on trunk.