diff mbox series

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

Message ID 20191210204045.GE10088@tucnak
State New
Headers show
Series Fix ICE in regstat_bb_compute_calls_crossed (PR rtl-optimization/92882) | expand

Commit Message

Jakub Jelinek Dec. 10, 2019, 8:40 p.m. UTC
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.


	Jakub

Comments

Jeff Law Dec. 10, 2019, 8:44 p.m. UTC | #1
On Tue, 2019-12-10 at 21:40 +0100, Jakub Jelinek wrote:
> 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.
OK
jeff
>
diff mbox series

Patch

--- 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'