re PR fortran/88206 (ICE in gfc_match_type_spec, at fortran/match.c:2229)
authorSteven G. Kargl <kargl@gcc.gnu.org>
Sun, 9 Dec 2018 19:10:57 +0000 (19:10 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sun, 9 Dec 2018 19:10:57 +0000 (19:10 +0000)
2018-12-09  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/88206
* match.c (gfc_match_type_spec): REAL can be an intrinsic function.

2018-12-09  Steven G. Kargl  <kargl@gcc.gnu.org>

PR fortran/88206
* gfortran.dg/pr88206.f90: New test.

From-SVN: r266930

gcc/fortran/ChangeLog
gcc/fortran/match.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr88206.f90 [new file with mode: 0644]

index f37ca637fa01c20e992dae57f888093abc1a7f65..f5c2f01bab46f154c488efa804e3ce2faa0fdd9e 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-09  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/88206
+       * match.c (gfc_match_type_spec): REAL can be an intrinsic function.
+
 2018-12-09  Fritz Reese  <fritzoreese@gmail.com>
 
        PR fortran/88228
index f22241da60ba2253b8ea0756819f0fa200192432..d548bb92c2dbde86ba9990151ae21893346cbaa0 100644 (file)
@@ -2225,6 +2225,9 @@ found:
              return MATCH_NO;
            }
 
+         if (e->expr_type != EXPR_CONSTANT)
+           goto ohno;
+
          gfc_next_char (); /* Burn the ')'. */
          ts->kind = (int) mpz_get_si (e->value.integer);
          if (gfc_validate_kind (ts->type, ts->kind , true) == -1)
@@ -2239,6 +2242,8 @@ found:
        }
     }
 
+ohno:
+
   /* If a type is not matched, simply return MATCH_NO.  */
   gfc_current_locus = old_locus;
   return MATCH_NO;
index 120fb9e13084e2a43ad8dcb309817f6706cdc78e..aac29ffe61416eec7d3e4705397a325cd0b9fcd0 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-09  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/88206
+       * gfortran.dg/pr88206.f90: New test.
+
 2018-12-09  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/88228
diff --git a/gcc/testsuite/gfortran.dg/pr88206.f90 b/gcc/testsuite/gfortran.dg/pr88206.f90
new file mode 100644 (file)
index 0000000..71c61f0
--- /dev/null
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR fortran/88206
+program p
+   integer, parameter :: z(4) = [1,2,3,4]
+   integer :: k = 2
+   print *, [real(z(k))]
+end
+