public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1477] Fortran: force error on bad KIND specifier [PR88552]
@ 2023-06-01 21:04 Harald Anlauf
  0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2023-06-01 21:04 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:ff8f45d20f9ea6acc99442ad29212d177f58e8fe

commit r14-1477-gff8f45d20f9ea6acc99442ad29212d177f58e8fe
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Thu Jun 1 23:04:30 2023 +0200

    Fortran: force error on bad KIND specifier [PR88552]
    
    gcc/fortran/ChangeLog:
    
            PR fortran/88552
            * decl.cc (gfc_match_kind_spec): Use error path on missing right
            parenthesis.
            (gfc_match_decl_type_spec): Use error return when an error occurred
            during matching a KIND specifier.
    
    gcc/testsuite/ChangeLog:
    
            PR fortran/88552
            * gfortran.dg/pr88552.f90: New test.

Diff:
---
 gcc/fortran/decl.cc                   | 4 ++++
 gcc/testsuite/gfortran.dg/pr88552.f90 | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc
index 1de2b231242..f5d39e2a3d8 100644
--- a/gcc/fortran/decl.cc
+++ b/gcc/fortran/decl.cc
@@ -3366,6 +3366,7 @@ close_brackets:
       else
 	gfc_error ("Missing right parenthesis at %C");
       m = MATCH_ERROR;
+      goto no_match;
     }
   else
      /* All tests passed.  */
@@ -4703,6 +4704,9 @@ get_kind:
     }
 
   m = gfc_match_kind_spec (ts, false);
+  if (m == MATCH_ERROR)
+    return MATCH_ERROR;
+
   if (m == MATCH_NO && ts->type != BT_CHARACTER)
     {
       m = gfc_match_old_kind_spec (ts);
diff --git a/gcc/testsuite/gfortran.dg/pr88552.f90 b/gcc/testsuite/gfortran.dg/pr88552.f90
new file mode 100644
index 00000000000..15e1b372f8f
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr88552.f90
@@ -0,0 +1,6 @@
+! { dg-do compile }
+! PR fortran/88552
+! Contributed by G.Steinmetz
+
+integer(len((c)) :: n   ! { dg-error "must be CHARACTER" }
+end

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-01 21:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-01 21:04 [gcc r14-1477] Fortran: force error on bad KIND specifier [PR88552] Harald Anlauf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).