[PATCH] Fix ICE in regstat_bb_compute_calls_crossed (PR rtl-optimization/92882)

Jakub Jelinek jakub@redhat.com
Tue Dec 10 20:41:00 GMT 2019


Hi!

The following testcase ICEs on the newly added asserts.
Some comments hint that maybe it is fine if CODE_LABEL additions don't
trigger df recomputations, but even if it is not ok,
regstat_bb_compute_calls_crossed doesn't look like an IL verification
routine and for !NONDEBUG_INSN_P it really doesn't need DF_INSN_INFO_GET
for anything, so I think it is best not to get it.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2019-12-10  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/92882
	* regstat.c (regstat_bb_compute_calls_crossed): Don't check
	INSN_UID against DF_INSN_SIZE or use DF_INSN_INFO_GET unless
	NONDEBUG_INSN_P.

	* gfortran.dg/pr92882.f: New test.

--- gcc/regstat.c.jj	2019-12-09 15:02:30.112287863 +0100
+++ gcc/regstat.c	2019-12-10 13:36:23.231327649 +0100
@@ -324,13 +324,13 @@ regstat_bb_compute_calls_crossed (unsign
 
   FOR_BB_INSNS_REVERSE (bb, insn)
     {
+      if (!NONDEBUG_INSN_P (insn))
+	continue;
+
       gcc_assert (INSN_UID (insn) < (int) DF_INSN_SIZE ());
       struct df_insn_info *insn_info = DF_INSN_INFO_GET (insn);
       unsigned int regno;
 
-      if (!NONDEBUG_INSN_P (insn))
-	continue;
-
       /* Process the defs.  */
       if (CALL_P (insn))
 	{
--- gcc/testsuite/gfortran.dg/pr92882.f.jj	2019-12-10 13:38:17.737571868 +0100
+++ gcc/testsuite/gfortran.dg/pr92882.f	2019-12-10 13:38:07.453729553 +0100
@@ -0,0 +1,4 @@
+C PR rtl-optimization/92882
+C { dg-do compile }
+C { dg-options "-O2 -fno-inline" }
+      INCLUDE 'secnds.f'

	Jakub



More information about the Gcc-patches mailing list