diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2007-04-07 20:25:43 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2007-04-07 20:25:43 +0000 |
commit | 145bdc2cbc1237d3f3ab25f45d18f1fce7ecb2b5 (patch) | |
tree | aef028cedf643c33e61fa8d4f28a708be3b4ce98 /gcc/fortran/resolve.c | |
parent | 4c6b3ec7507e827156a1fdf8b904303b50eedf75 (diff) | |
download | gcc-145bdc2cbc1237d3f3ab25f45d18f1fce7ecb2b5.zip gcc-145bdc2cbc1237d3f3ab25f45d18f1fce7ecb2b5.tar.gz gcc-145bdc2cbc1237d3f3ab25f45d18f1fce7ecb2b5.tar.bz2 |
re PR fortran/30880 (Derived types with default value -- function with ENTRY: rejected at compile time)
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30880
* resolve.c (resolve_fl_variable): Set flag to 2 for automatic
arrays. Make condition for automatic array error explicit.
If a dummy, no error on an INTENT(OUT) derived type.
2007-04-07 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30880
* gfortran.dg/used_dummy_types_8.f90: New test.
From-SVN: r123645
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 03e6360..f514e77 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -5648,7 +5648,7 @@ resolve_fl_variable (gfc_symbol *sym, int mp_flag) || sym->as->upper[i] == NULL || sym->as->upper[i]->expr_type != EXPR_CONSTANT) { - flag = 1; + flag = 2; break; } } @@ -5670,7 +5670,8 @@ resolve_fl_variable (gfc_symbol *sym, int mp_flag) else if (sym->attr.external) gfc_error ("External '%s' at %L cannot have an initializer", sym->name, &sym->declared_at); - else if (sym->attr.dummy) + else if (sym->attr.dummy + && !(sym->ts.type == BT_DERIVED && sym->attr.intent == INTENT_OUT)) gfc_error ("Dummy '%s' at %L cannot have an initializer", sym->name, &sym->declared_at); else if (sym->attr.intrinsic) @@ -5679,12 +5680,15 @@ resolve_fl_variable (gfc_symbol *sym, int mp_flag) else if (sym->attr.result) gfc_error ("Function result '%s' at %L cannot have an initializer", sym->name, &sym->declared_at); - else + else if (flag == 2) gfc_error ("Automatic array '%s' at %L cannot have an initializer", sym->name, &sym->declared_at); + else + goto no_init_error; return FAILURE; } +no_init_error: /* Check to see if a derived type is blocked from being host associated by the presence of another class I symbol in the same namespace. 14.6.1.3 of the standard and the discussion on comp.lang.fortran. */ |