This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/55199] [OOP] Equivalenced variable has wrong type when used with generic member function
- From: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 04 Nov 2012 13:56:03 +0000
- Subject: [Bug fortran/55199] [OOP] Equivalenced variable has wrong type when used with generic member function
- Auto-submitted: auto-generated
- References: <bug-55199-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55199
--- Comment #5 from janus at gcc dot gnu.org 2012-11-04 13:56:03 UTC ---
Here is an improved patch, which hopefully should be free of testsuite
regressions (will re-check):
Index: gcc/fortran/parse.c
===================================================================
--- gcc/fortran/parse.c (revision 193133)
+++ gcc/fortran/parse.c (working copy)
@@ -3395,12 +3395,10 @@ parse_associate (void)
sym->declared_at = a->where;
gfc_set_sym_referenced (sym);
- /* Initialize the typespec. It is not available in all cases,
- however, as it may only be set on the target during resolution.
- Still, sometimes it helps to have it right now -- especially
- for parsing component references on the associate-name
- in case of association to a derived-type. */
- sym->ts = a->target->ts;
+ /* For variables, we can already set the typespec. Other cases have to
+ wait until resolution stage. */
+ if (a->target->expr_type == EXPR_VARIABLE)
+ sym->ts = a->target->ts;
}
accept_statement (ST_ASSOCIATE);