public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4964] Fortran: a symbol in a COMMON cannot be a coarray
@ 2021-11-05 22:15 Harald Anlauf
0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2021-11-05 22:15 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:432ed97b992ccfe93616d5af1fa5c1a7d7aff9ff
commit r12-4964-g432ed97b992ccfe93616d5af1fa5c1a7d7aff9ff
Author: Harald Anlauf <anlauf@gmx.de>
Date: Fri Nov 5 23:13:57 2021 +0100
Fortran: a symbol in a COMMON cannot be a coarray
gcc/fortran/ChangeLog:
PR fortran/69419
* match.c (gfc_match_common): Check array spec of a symbol in a
COMMON object list and reject it if it is a coarray.
gcc/testsuite/ChangeLog:
PR fortran/69419
* gfortran.dg/pr69419.f90: New test.
Diff:
---
gcc/fortran/match.c | 7 +++++++
gcc/testsuite/gfortran.dg/pr69419.f90 | 9 +++++++++
2 files changed, 16 insertions(+)
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 5d07f897e45..2bf21434a42 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -5288,6 +5288,13 @@ gfc_match_common (void)
goto cleanup;
}
+ if (as->corank)
+ {
+ gfc_error ("Symbol %qs in COMMON at %C cannot be a "
+ "coarray", sym->name);
+ goto cleanup;
+ }
+
if (!gfc_add_dimension (&sym->attr, sym->name, NULL))
goto cleanup;
diff --git a/gcc/testsuite/gfortran.dg/pr69419.f90 b/gcc/testsuite/gfortran.dg/pr69419.f90
new file mode 100644
index 00000000000..7329808611c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr69419.f90
@@ -0,0 +1,9 @@
+! { dg-do compile }
+! { dg-options "-fcoarray=lib" }
+! PR fortran/69419 - ICE on invalid coarray in common
+
+blockdata b
+ real x ! { dg-error "must be in COMMON" }
+ common /c/ x[*] ! { dg-error "cannot be a coarray" }
+ data x /1.0/
+end
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-11-05 22:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-05 22:15 [gcc r12-4964] Fortran: a symbol in a COMMON cannot be a coarray 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).