diff options
author | Harald Anlauf <anlauf@gmx.de> | 2021-10-26 22:14:19 +0200 |
---|---|---|
committer | Harald Anlauf <anlauf@gmx.de> | 2021-10-26 22:14:19 +0200 |
commit | 662f64a1f9e2de65982e4d895b3afe72cbf581ba (patch) | |
tree | a220806d84b73475e592ddbabebf3282ceac69c2 /gcc | |
parent | 8c59f4118357789cfa8df2cf0d3ecb61be7e9041 (diff) | |
download | gcc-662f64a1f9e2de65982e4d895b3afe72cbf581ba.zip gcc-662f64a1f9e2de65982e4d895b3afe72cbf581ba.tar.gz gcc-662f64a1f9e2de65982e4d895b3afe72cbf581ba.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/symbol.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pdt_32.f03 | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 2c4acd5..c77f3f8 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 0000000..f8d4041 --- /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 |