summaryrefslogtreecommitdiff
path: root/gcc/fortran/match.c
diff options
context:
space:
mode:
authorDaniel Kraft <d@domob.eu>2010-08-17 10:20:03 +0200
committerDaniel Kraft <domob@gcc.gnu.org>2010-08-17 10:20:03 +0200
commit571d54deb6edc944f1e9f361302b2fa99b568d64 (patch)
treec4e60dabb6b71164f854d91556581ddd4452d41a /gcc/fortran/match.c
parent3373692b59f62e6dfeaa6a3b2f19610bf6ea3886 (diff)
downloadgcc-571d54deb6edc944f1e9f361302b2fa99b568d64.tar.gz
re PR fortran/38936 ([F03] ASSOCIATE construct / improved SELECT TYPE (a=>expr))
2010-08-17 Daniel Kraft <d@domob.eu> PR fortran/38936 * gfortran.h (struct gfc_association_list): New member `where'. (gfc_is_associate_pointer) New method. * match.c (gfc_match_associate): Remember locus for each associate name matched and do not try to set variable flag. * parse.c (parse_associate): Use remembered locus for symbols. * primary.c (match_variable): Instead of variable-flag check for associate names set it for all such names used. * symbol.c (gfc_is_associate_pointer): New method. * resolve.c (resolve_block_construct): Don't generate assignments to give associate-names their values. (resolve_fl_var_and_proc): Allow associate-names to be deferred-shape. (resolve_symbol): Set some more attributes for associate variables, set variable flag here and check it and don't try to build an explicitely shaped array-spec for array associate variables. * trans-expr.c (gfc_conv_variable): Dereference in case of association to scalar variable. * trans-types.c (gfc_is_nodesc_array): Handle array association symbols. (gfc_sym_type): Return pointer type for association to scalar vars. * trans-decl.c (gfc_get_symbol_decl): Defer association symbols. (trans_associate_var): New method. (gfc_trans_deferred_vars): Handle association symbols. 2010-08-17 Daniel Kraft <d@domob.eu> PR fortran/38936 * gfortran.dg/associate_1.f03: Extended to test newly supported features like association to variables. * gfortran.dg/associate_3.f03: Removed check for illegal change of associate-name here... * gfortran.dg/associate_5.f03: ...and added it here. * gfortran.dg/associate_6.f03: No longer XFAIL'ed. * gfortran.dg/associate_7.f03: New test. From-SVN: r163295
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r--gcc/fortran/match.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index a37a6798a84..c1cef962248 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -1827,6 +1827,7 @@ gfc_match_associate (void)
gfc_error ("Expected association at %C");
goto assocListError;
}
+ newAssoc->where = gfc_current_locus;
/* Check that the current name is not yet in the list. */
for (a = new_st.ext.block.assoc; a; a = a->next)
@@ -1844,10 +1845,11 @@ gfc_match_associate (void)
goto assocListError;
}
- /* The target is a variable (and may be used as lvalue) if it's an
- EXPR_VARIABLE and does not have vector-subscripts. */
- newAssoc->variable = (newAssoc->target->expr_type == EXPR_VARIABLE
- && !gfc_has_vector_subscript (newAssoc->target));
+ /* The `variable' field is left blank for now; because the target is not
+ yet resolved, we can't use gfc_has_vector_subscript to determine it
+ for now. Instead, if the symbol is matched as variable, this field
+ is set -- and during resolution we check that. */
+ newAssoc->variable = 0;
/* Put it into the list. */
newAssoc->next = new_st.ext.block.assoc;