From 2d93be8907fa33f8791409490ed06e45de5c8420 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Tue, 2 Sep 2025 21:48:55 +0100 Subject: Fortran: Handle PDTs correctly with unlimited selector [PR87669] 2025-09-02 Paul Thomas gcc/fortran PR fortran/87669 * expr.cc (gfc_spec_list_type): If no LEN components are seen, unconditionally return 'SPEC_ASSUMED'. This suppresses an invalid error in match.cc(gfc_match_type_is). gcc/testsuite/ PR fortran/87669 * gfortran.dg/pdt_42.f03: New test. libgfortran/ PR fortran/87669 * intrinsics/extends_type_of.c (is_extension_of): Use the vptr rather than the hash value to identify the types. --- gcc/fortran/expr.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/expr.cc b/gcc/fortran/expr.cc index b8d04ff..97f931a 100644 --- a/gcc/fortran/expr.cc +++ b/gcc/fortran/expr.cc @@ -5911,6 +5911,7 @@ gfc_spec_list_type (gfc_actual_arglist *param_list, gfc_symbol *derived) gfc_component *c; bool seen_assumed = false; bool seen_deferred = false; + bool seen_len = false; if (derived == NULL) { @@ -5932,10 +5933,12 @@ gfc_spec_list_type (gfc_actual_arglist *param_list, gfc_symbol *derived) return SPEC_EXPLICIT; seen_assumed = param_list->spec_type == SPEC_ASSUMED; seen_deferred = param_list->spec_type == SPEC_DEFERRED; + if (c->attr.pdt_len) + seen_len = true; if (seen_assumed && seen_deferred) return SPEC_EXPLICIT; } - res = seen_assumed ? SPEC_ASSUMED : SPEC_DEFERRED; + res = (seen_assumed || !seen_len) ? SPEC_ASSUMED : SPEC_DEFERRED; } return res; } -- cgit v1.1