public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-4722] Fortran: [PDT] KIND and LEN type parameters are mutually exclusive
@ 2021-10-26 20:15 Harald Anlauf
0 siblings, 0 replies; only message in thread
From: Harald Anlauf @ 2021-10-26 20:15 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:662f64a1f9e2de65982e4d895b3afe72cbf581ba
commit r12-4722-g662f64a1f9e2de65982e4d895b3afe72cbf581ba
Author: Harald Anlauf <anlauf@gmx.de>
Date: Tue Oct 26 22:14:19 2021 +0200
Fortran: [PDT] KIND and LEN type parameters are mutually exclusive
gcc/fortran/ChangeLog:
PR fortran/102956
* symbol.c (gfc_check_conflict): Add conflict check for PDT KIND
and LEN type parameters.
gcc/testsuite/ChangeLog:
PR fortran/102956
* gfortran.dg/pdt_32.f03: New test.
Diff:
---
gcc/fortran/symbol.c | 1 +
gcc/testsuite/gfortran.dg/pdt_32.f03 | 17 +++++++++++++++++
2 files changed, 18 insertions(+)
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 2c4acd5abe1..c77f3f84962 100644
--- a/gcc/fortran/symbol.c
+++ b/gcc/fortran/symbol.c
@@ -720,6 +720,7 @@ gfc_check_conflict (symbol_attribute *attr, const char *name, locus *where)
conf (pdt_len, pointer)
conf (pdt_len, dimension)
conf (pdt_len, codimension)
+ conf (pdt_len, pdt_kind)
if (attr->access == ACCESS_PRIVATE)
{
diff --git a/gcc/testsuite/gfortran.dg/pdt_32.f03 b/gcc/testsuite/gfortran.dg/pdt_32.f03
new file mode 100644
index 00000000000..f8d40410828
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pdt_32.f03
@@ -0,0 +1,17 @@
+! { dg-do compile }
+! PR fortran/102956
+! PDT KIND and LEN type parameters are mutually exclusive (F2018:R734)
+!
+module m
+ type :: good_pdt (k,l)
+ integer, kind :: k = 1
+ integer, len :: l = 1
+ character(kind=k,len=l) :: c
+ end type good_pdt
+
+ type :: bad_pdt (k,l) ! { dg-error "does not have a component" }
+ integer, kind, len :: k = 1 ! { dg-error "attribute conflicts with" }
+ integer, len, kind :: l = 1 ! { dg-error "attribute conflicts with" }
+ character(kind=k,len=l) :: c ! { dg-error "has not been declared" }
+ end type bad_pdt
+end
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-26 20:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 20:15 [gcc r12-4722] Fortran: [PDT] KIND and LEN type parameters are mutually exclusive 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).