]> gcc.gnu.org Git - gcc.git/commitdiff
[Fortran] ICE in gfc_typenode_for_spec PR93603
authorMark Eggleston <markeggleston@gcc.gnu.org>
Tue, 18 Feb 2020 12:23:20 +0000 (12:23 +0000)
committerMark Eggleston <markeggleston@gcc.gnu.org>
Tue, 18 Feb 2020 12:23:20 +0000 (12:23 +0000)
Associating a symbol with a BOZ constant caused an ICE.  Output
an error message as an association target cannot be a BOZ
constant.

Original patch provided by Steven G. Kargl  <kargl@gcc.gnu.org>.

gcc/fortran/ChangeLog

PR fortran/93603
* match.c (gfc_match_associate) : If target expression
has the type BT_BOZ output an error and goto
assocListError.

gcc/testsuite/ChangeLog

PR fortran/93603
* gfortran.dg/pr93603.f90 : New test.

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

index 302af3aa9903dbd61246d1102a65553075737b61..2e874b83c64a2f65b34bf4bfa30819eb8d42aa71 100644 (file)
@@ -1,3 +1,10 @@
+2020-02-18  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+       PR fortran/93603
+       * match.c (gfc_match_associate) : If target expression
+       has the type BT_BOZ output an error and goto
+       assocListError.
+
 2020-02-18  Steven G. Kargl  <kargl@gcc.gnu.org>
            Mark Eggleston  <markeggleston@gcc.gnu.org>
 
index a74cb8c5c1966dcf856d8fd171565f048f8365ed..9c2ec41c49c620caa865ee16b8de460fb2c0a837 100644 (file)
@@ -1957,6 +1957,14 @@ gfc_match_associate (void)
          goto assocListError;
        }
 
+      /* The target expression cannot be a BOZ literal constant.  */
+      if (newAssoc->target->ts.type == BT_BOZ)
+       {
+         gfc_error ("Association target at %L cannot be a BOZ literal "
+                    "constant", &newAssoc->target->where);
+         goto assocListError;
+       }
+
       /* The `variable' field is left blank for now; because the target is not
         yet resolved, we can't use gfc_has_vector_subscript to determine it
         for now.  This is set during resolution.  */
index 1c7f879bf66d163fffde32ae277b578137463852..f9a545e2d934a4f34908a32cf66d26889879b6b0 100644 (file)
@@ -1,3 +1,8 @@
+2020-02-18  Mark Eggleston  <mark.eggleston@codethink.com>
+
+       PR fortran/93603
+       * gfortran.dg/pr93603.f90 : New test.
+
 2020-02-20  Mark Eggleston <markeggleston@gcc.gnu.org>
 
        PR fortran/93580
diff --git a/gcc/testsuite/gfortran.dg/pr93603.f90 b/gcc/testsuite/gfortran.dg/pr93603.f90
new file mode 100644 (file)
index 0000000..fd452e5
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+
+program p
+  associate (y => z'1') ! { dg-error "cannot be a BOZ literal constant" }
+  end associate         ! { dg-error "Expecting END PROGRAM" }
+end
+
This page took 0.081328 seconds and 5 git commands to generate.