diff options
author | vehre <vehre@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-11 16:48:45 +0000 |
---|---|---|
committer | vehre <vehre@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-02-11 16:48:45 +0000 |
commit | 42c87ca93df2410a1efeed08cad97b44e00818a9 (patch) | |
tree | 4f0f282a748ce12fc4fc2f005187201258537e3f /gcc/fortran/resolve.c | |
parent | acb7939f209b076d09beba114014d7bac4864278 (diff) |
gcc/fortran/ChangeLog:
2016-02-11 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/69296
* gfortran.h: Added flag to gfc_association_list indicating that
the rank of an associate variable has been guessed only.
* parse.c (parse_associate): Set the guess flag mentioned above
when guessing the rank of an expression.
* resolve.c (resolve_assoc_var): When the rank has been guessed,
make sure, that the guess was correct else overwrite with the actual
rank.
* trans-stmt.c (trans_associate_var): For subref_array_pointers in
class objects, take the span from the _data component.
gcc/testsuite/ChangeLog:
2016-02-11 Andre Vehreschild <vehre@gcc.gnu.org>
PR fortran/69296
* gfortran.dg/associate_19.f03: New test.
* gfortran.dg/associate_20.f03: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233351 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index e6c3ff952e2..556c8469d28 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -4777,7 +4777,7 @@ fail: /* Given a variable expression node, compute the rank of the expression by examining the base symbol and any reference structures it may have. */ -static void +void expression_rank (gfc_expr *e) { gfc_ref *ref; @@ -8153,16 +8153,19 @@ resolve_assoc_var (gfc_symbol* sym, bool resolve_target) if (target->rank != 0) { gfc_array_spec *as; - if (sym->ts.type != BT_CLASS && !sym->as) + /* The rank may be incorrectly guessed at parsing, therefore make sure + it is corrected now. */ + if (sym->ts.type != BT_CLASS && (!sym->as || sym->assoc->rankguessed)) { - as = gfc_get_array_spec (); + if (!sym->as) + sym->as = gfc_get_array_spec (); + as = sym->as; as->rank = target->rank; as->type = AS_DEFERRED; as->corank = gfc_get_corank (target); sym->attr.dimension = 1; if (as->corank != 0) sym->attr.codimension = 1; - sym->as = as; } } else |