diff options
author | domob <domob@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-17 08:20:03 +0000 |
---|---|---|
committer | domob <domob@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-17 08:20:03 +0000 |
commit | 8f3f9eab5083b3a78a92dfb3fae63f80039689a3 (patch) | |
tree | c4e60dabb6b71164f854d91556581ddd4452d41a /gcc/fortran/parse.c | |
parent | d6263c494d25347c96317361668bacbe995aad89 (diff) | |
download | gcc-8f3f9eab5083b3a78a92dfb3fae63f80039689a3.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163295 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r-- | gcc/fortran/parse.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 72a82c7649d..cbb945aa9a5 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -3215,23 +3215,21 @@ parse_associate (void) new_st.ext.block.ns = my_ns; gcc_assert (new_st.ext.block.assoc); - /* Add all associate-names as BLOCK variables. There values will be assigned - to them during resolution of the ASSOCIATE construct. */ + /* Add all associate-names as BLOCK variables. Creating them is enough + for now, they'll get their values during trans-* phase. */ gfc_current_ns = my_ns; for (a = new_st.ext.block.assoc; a; a = a->next) { - if (a->variable) - { - gfc_error ("Association to variables is not yet supported at %C"); - return; - } + gfc_symbol* sym; if (gfc_get_sym_tree (a->name, NULL, &a->st, false)) gcc_unreachable (); - a->st->n.sym->attr.flavor = FL_VARIABLE; - a->st->n.sym->assoc = a; - gfc_set_sym_referenced (a->st->n.sym); + sym = a->st->n.sym; + sym->attr.flavor = FL_VARIABLE; + sym->assoc = a; + sym->declared_at = a->where; + gfc_set_sym_referenced (sym); } accept_statement (ST_ASSOCIATE); |