[Bug middle-end/92410] Invalid access to df->insns[] in regstat_bb_compute_calls_crossed (caught by hwasan)
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 8 08:51:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92410
--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
One can see it with the following patch:
diff --git a/gcc/regstat.c b/gcc/regstat.c
index 4da9b7cc523..c6cefb117d7 100644
--- a/gcc/regstat.c
+++ b/gcc/regstat.c
@@ -324,6 +324,7 @@ regstat_bb_compute_calls_crossed (unsigned int bb_index,
bitmap live)
FOR_BB_INSNS_REVERSE (bb, insn)
{
+ gcc_assert (INSN_UID (insn) < DF_INSN_SIZE ());
struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
unsigned int regno;
and with the following test-case:
$ cat /tmp/ice.i
int v;
int a() {
;
return v;
}
$ ./xgcc -B. /tmp/ice.i -O2 -c -g
during RTL pass: sched2
/tmp/ice.i: In function ‘a’:
/tmp/ice.i:6:1: internal compiler error: in regstat_bb_compute_calls_crossed,
at regstat.c:327
6 | }
| ^
0x10519d1 regstat_bb_compute_calls_crossed
../../gcc/regstat.c:327
0x1051c0e regstat_compute_calls_crossed()
../../gcc/regstat.c:380
0x1d30bbd sched_init()
../../gcc/haifa-sched.c:7337
0x1d30c21 haifa_sched_init()
../../gcc/haifa-sched.c:7354
0x10acbac schedule_insns()
../../gcc/sched-rgn.c:3514
0x10ad507 rest_of_handle_sched2
../../gcc/sched-rgn.c:3746
0x10ad6ce execute
../../gcc/sched-rgn.c:3882
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Looks that GCC 9 branch point is also affected. I'm going to bisect further.
More information about the Gcc-bugs
mailing list