From bae66e0f04323ba9d5daf60fcb997de925100e3e Mon Sep 17 00:00:00 2001 From: Mark Eggleston Date: Wed, 10 Jun 2020 07:22:50 +0100 Subject: Fortran : accepts pointer initialization of DT dummy args PR45337 Initialisation of a variable results in an implicit save attribute being added to the variable. The save attribute is not allowed for variables with the dummy attribute set. Initialisation should be rejected for dummy variables. 2020-07-13 Mark Eggleston gcc/fortran/ PR fortran/45337 * resolve.c (resolve_fl_variable): Remove type and intent checks from the check for dummy. 2020-07-13 Mark Eggleston gcc/testsuite/ PR fortran/45337 * gfortran.dg/pr45337_1.f90: New test. * gfortran.dg/pr45337_2.f90: New test. --- gcc/fortran/resolve.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gcc/fortran/resolve.c') diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index b1238c8..2751c0c 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -12927,8 +12927,7 @@ resolve_fl_variable (gfc_symbol *sym, int mp_flag) else if (sym->attr.external) gfc_error ("External %qs at %L cannot have an initializer", sym->name, &sym->declared_at); - else if (sym->attr.dummy - && !(sym->ts.type == BT_DERIVED && sym->attr.intent == INTENT_OUT)) + else if (sym->attr.dummy) gfc_error ("Dummy %qs at %L cannot have an initializer", sym->name, &sym->declared_at); else if (sym->attr.intrinsic) -- cgit v1.1