]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fortran: do not restrict PDT KIND and LEN type parameters to default integer
authorHarald Anlauf <anlauf@gmx.de>
Tue, 26 Oct 2021 18:54:41 +0000 (20:54 +0200)
committerHarald Anlauf <anlauf@gmx.de>
Wed, 27 Oct 2021 19:25:39 +0000 (21:25 +0200)
gcc/fortran/ChangeLog:

PR fortran/102917
* decl.c (match_attr_spec): Remove invalid integer kind checks on
KIND and LEN attributes of PDTs.

gcc/testsuite/ChangeLog:

PR fortran/102917
* gfortran.dg/pdt_4.f03: Adjust testcase.

(cherry picked from commit cfcb27cfcb1d32b8cf7bc463cc1fc5cacae8d199)

gcc/fortran/decl.c
gcc/testsuite/gfortran.dg/pdt_4.f03

index 9b952b1bd75d972239b7b5862245e2cb2e49d058..4606155f699929645b3b6f288c9a35db5746bcbf 100644 (file)
@@ -5506,14 +5506,6 @@ match_attr_spec (void)
                  m = MATCH_ERROR;
                  goto cleanup;
                }
-             if (current_ts.kind != gfc_default_integer_kind)
-               {
-                 gfc_error ("Component with KIND attribute at %C must be "
-                            "default integer kind (%d)",
-                             gfc_default_integer_kind);
-                 m = MATCH_ERROR;
-                 goto cleanup;
-               }
            }
          else if (d == DECL_LEN)
            {
@@ -5533,14 +5525,6 @@ match_attr_spec (void)
                  m = MATCH_ERROR;
                  goto cleanup;
                }
-             if (current_ts.kind != gfc_default_integer_kind)
-               {
-                 gfc_error ("Component with LEN attribute at %C must be "
-                            "default integer kind (%d)",
-                             gfc_default_integer_kind);
-                 m = MATCH_ERROR;
-                 goto cleanup;
-               }
            }
          else
            {
index c1af65a52487361ba9d361a043d3e1fe0d943146..37412e4ca828b22c3a6b8f281fdd9d19a33c7591 100644 (file)
@@ -28,9 +28,9 @@ end module
 
   type :: bad_pdt (a,b, c, d)  ! { dg-error "does not have a component" }
     real, kind :: a            ! { dg-error "must be INTEGER" }
-    INTEGER(8), kind :: b      ! { dg-error "be default integer kind" }
+    INTEGER(8), kind :: b
     real, LEN :: c             ! { dg-error "must be INTEGER" }
-    INTEGER(8), LEN :: d       ! { dg-error "be default integer kind" }
+    INTEGER(8), LEN :: d
   end type
 
   type :: mytype (a,b)