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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Dunno if it isn't just workaround, but it makes absolutely no sense to
DF_INSN_INFO_GET on insns for which we really don't need it, such as debug
insns, CODE_LABEL etc. for which we never use insn_info and we just continue;.
Patch like below fixes the ICE for me.
The question is if we just have some exception that for new labels etc. we
don't grow the tables, while for insns we always do.  If yes, the patch is a
real fix, if not, we can wait for further ICEs on the same assertion.

2019-12-10  Jakub Jelinek  <ja...@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'

Reply via email to