Dear Harald, dear all,

On 24.10.21 21:00, Harald Anlauf via Fortran wrote:
I've created PR 102917 for tracking this issue and packaged
the attached patch.

Regtested on x86_64-pc-linux-gnu.  OK mainline?

OK. I wonder whether a valid len/kind example should be added which uses
such a PDT with non-default-kind integer.

Tobias

Gesendet: Freitag, 22. Oktober 2021 um 22:25 Uhr
Von: "Steve Kargl" <s...@troutmask.apl.washington.edu>
An: "Harald Anlauf" <anl...@gmx.de>
Cc: fortran@gcc.gnu.org
Betreff: Re: PDT type parameters are not restricted to default integer

On Fri, Oct 22, 2021 at 10:16:05PM +0200, Harald Anlauf wrote:
Hi Steve,

Am 22.10.21 um 21:35 schrieb Steve Kargl via Fortran:
Here's an obvious quick fix.  Please apply.


diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c
index 6043e100fbb..e889bb44142 100644
--- a/gcc/fortran/decl.c
+++ b/gcc/fortran/decl.c
@@ -5619,14 +5619,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
               {
I think you are right.  We should always have allowed any integer kind.

However, have you checked whether this change introduces regressions?
If you don't, somebody else will.  Please open a PR, then.

It seems that pdt_4.f03 will fail with the above patch because
it explicitly tests for this error message.  That's the only
failure in the testsuite.  For the record, F2003, page 48,

    R435 type-param-def-stmt  is INTEGER [ kind-selector ] , ...

    Each type parameter is itself of type integer.  If its kind selector
    is omitted, the kind type parameter is default integer.

Now that I think about and look, there is a nearby similar gcc_error()
for KIND.  This should be removed too.

--
Steve

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955

Reply via email to