[Bug fortran/99351] ICE in gfc_finish_var_decl, at fortran/trans-decl.c:695

kargl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Mar 3 02:00:54 GMT 2021


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

kargl at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-03-03
     Ever confirmed|0                           |1
                 CC|                            |kargl at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
           Priority|P3                          |P4

--- Comment #1 from kargl at gcc dot gnu.org ---
Tested against original code here.  Note regression tested.

diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 4d5890fd523..94f5a1dc464 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -3867,6 +3867,15 @@ sync_statement (gfc_statement st)
          stat = tmp;
          saw_stat = true;

+         if (tmp->symtree
+             && (tmp->symtree->n.sym->attr.flavor == FL_PARAMETER
+                 || tmp->symtree->n.sym->ts.type != BT_INTEGER))
+           {
+             gfc_error ("Expecting scalar-int-variable at %L",
+                        &tmp->where);
+             goto cleanup;
+           }
+
          if (gfc_match_char (',') == MATCH_YES)
            continue;

@@ -3884,6 +3893,16 @@ sync_statement (gfc_statement st)
              gfc_error ("Redundant ERRMSG tag found at %L", &tmp->where);
              goto cleanup;
            }
+
+         if (tmp->symtree
+             && (tmp->symtree->n.sym->attr.flavor == FL_PARAMETER
+                 || tmp->symtree->n.sym->ts.type != BT_CHARACTER))
+           {
+             gfc_error ("Expecting scalar-default-char-variable at %L",
+                        &tmp->where);
+             goto cleanup;
+           }
+
          errmsg = tmp;
          saw_errmsg = true;


More information about the Gcc-bugs mailing list