diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2017-09-21 18:40:21 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2017-09-21 18:40:21 +0000 |
commit | b89a63b916340ef29aa94710e43dced8b2fcf129 (patch) | |
tree | 3c511b271a1280d31765510df2c68660e8f25fa7 /gcc/fortran/resolve.c | |
parent | 2bc668c2749292460764d0474707ece913038fbc (diff) | |
download | gcc-b89a63b916340ef29aa94710e43dced8b2fcf129.zip gcc-b89a63b916340ef29aa94710e43dced8b2fcf129.tar.gz gcc-b89a63b916340ef29aa94710e43dced8b2fcf129.tar.bz2 |
re PR fortran/52832 ([F03] ASSOCIATE construct with proc-pointer selector is rejected)
2017-09-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/52832
* match.c (gfc_match_associate): Before failing the association
try again, allowing a proc pointer selector.
PR fortran/80120
PR fortran/81903
PR fortran/82121
* primary.c (gfc_match_varspec): Introduce 'tgt_expr', which
points to the associate selector, if any. Go through selector
references, after resolution for variables, to catch any full
or section array references. If a class associate name does
not have the same declared type as the selector, resolve the
selector and copy the declared type to the associate name.
Before throwing a no implicit type error, resolve all allowed
selector expressions, and copy the resulting typespec.
PR fortran/67543
* resolve.c (resolve_assoc_var): Selector must cannot be the
NULL expression and it must have a type.
PR fortran/78152
* resolve.c (resolve_symbol): Allow associate names to be
coarrays.
2017-09-21 Paul Thomas <pault@gcc.gnu.org>
PR fortran/78512
* gfortran.dg/associate_26.f90 : New test.
PR fortran/80120
* gfortran.dg/associate_27.f90 : New test.
PR fortran/81903
* gfortran.dg/associate_28.f90 : New test.
PR fortran/82121
* gfortran.dg/associate_29.f90 : New test.
PR fortran/67543
* gfortran.dg/associate_30.f90 : New test.
PR fortran/52832
* gfortran.dg/associate_31.f90 : New test.
From-SVN: r253077
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 89dea5f..a3a62de 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -8396,11 +8396,23 @@ resolve_assoc_var (gfc_symbol* sym, bool resolve_target) sym->attr.subref_array_pointer = 1; } + if (target->expr_type == EXPR_NULL) + { + gfc_error ("Selector at %L cannot be NULL()", &target->where); + return; + } + else if (target->ts.type == BT_UNKNOWN) + { + gfc_error ("Selector at %L has no type", &target->where); + return; + } + /* Get type if this was not already set. Note that it can be some other type than the target in case this is a SELECT TYPE selector! So we must not update when the type is already there. */ if (sym->ts.type == BT_UNKNOWN) sym->ts = target->ts; + gcc_assert (sym->ts.type != BT_UNKNOWN); /* See if this is a valid association-to-variable. */ @@ -11926,6 +11938,7 @@ deferred_requirements (gfc_symbol *sym) if (sym->ts.deferred && !(sym->attr.pointer || sym->attr.allocatable + || sym->attr.associate_var || sym->attr.omp_udr_artificial_var)) { gfc_error ("Entity %qs at %L has a deferred type parameter and " @@ -14763,6 +14776,7 @@ resolve_symbol (gfc_symbol *sym) if (class_attr.codimension && !(class_attr.allocatable || sym->attr.dummy || sym->attr.save || sym->attr.select_type_temporary + || sym->attr.associate_var || (sym->ns->save_all && !sym->attr.automatic) || sym->ns->proc_name->attr.flavor == FL_MODULE || sym->ns->proc_name->attr.is_main_program |