summaryrefslogtreecommitdiff
path: root/gcc/fortran/primary.c
diff options
context:
space:
mode:
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-22 15:46:41 +0000
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-22 15:46:41 +0000
commitbe0f1581f250c18ae6e30def1433717e5595a2e2 (patch)
tree67fbb65e9ee062ee2344f0156c199922dd6c94dc /gcc/fortran/primary.c
parent4cac39455215a243e113a3dee1e9412dd1f86b23 (diff)
downloadgcc-be0f1581f250c18ae6e30def1433717e5595a2e2.tar.gz
2007-09-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/33337 PR fortran/33376 * trans-decl.c (gfc_create_module_variable): Output derived type parameters. * arith.c (gfc_parentheses): Return the argument if it is a constant expression. * primary.c (gfc_match_rvalue): Remove the clearing of the module name and the use_assoc attribute for derived type parameter expressions. 2007-09-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/33337 * gfortran.dg/derived_comp_array_ref_3.f90: New test. PR fortran/33376 * gfortran.dg/derived_comp_array_ref_4.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128672 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r--gcc/fortran/primary.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c
index f62299613fb..575a4c7411a 100644
--- a/gcc/fortran/primary.c
+++ b/gcc/fortran/primary.c
@@ -2148,11 +2148,12 @@ gfc_match_rvalue (gfc_expr **result)
if (sym->ts.is_c_interop || sym->ts.is_iso_c)
break;
- /* Variable array references to derived type parameters cause
- all sorts of headaches in simplification. Make them variable
- and scrub any module identity because they do not appear to
- be referencable from the module. */
- if (sym->value && sym->ts.type == BT_DERIVED && e->ref)
+ /* Variable array references to use associated derived type
+ parameters cause all sorts of headaches in simplification.
+ For this reason, we write the parameter to the module and
+ treat them as variable references. */
+ if (sym->value && sym->ts.type == BT_DERIVED
+ && sym->attr.use_assoc && e->ref)
{
for (ref = e->ref; ref; ref = ref->next)
if (ref->type == REF_ARRAY)
@@ -2168,8 +2169,6 @@ gfc_match_rvalue (gfc_expr **result)
e->expr_type = EXPR_VARIABLE;
e->symtree = symtree;
e->ref = ref;
- sym->attr.use_assoc = 0;
- sym->module = NULL;
}
break;