From 75cdd535b1a47abdfc60a2950367fd4de7fae8ab Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Thu, 18 Oct 2018 10:37:39 +0000 Subject: re PR fortran/58618 (Wrong code with character substring and ASSOCIATE) 2018-10-18 Paul Thomas PR fortran/58618 * trans-stmt.c (trans_associate_var): All strings that return as pointer types can be assigned directly to the associate name so remove 'attr' and the condition that uses it. 2018-10-18 Paul Thomas PR fortran/58618 * gfortran.dg/associate_45.f90 : New test. From-SVN: r265264 --- gcc/fortran/ChangeLog | 7 +++++++ gcc/fortran/trans-stmt.c | 7 ++----- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5ca39af..13e3581 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,6 +1,13 @@ 2018-10-18 Paul Thomas PR fortran/58618 + * trans-stmt.c (trans_associate_var): All strings that return + as pointer types can be assigned directly to the associate + name so remove 'attr' and the condition that uses it. + +2018-10-18 Paul Thomas + + PR fortran/58618 * trans-decl.c (gfc_get_symbol_decl): Deal correctly with the initialization with NULL() of a deferred length pointer. diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index c778df0..00fdf19 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -1656,7 +1656,6 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block) bool need_len_assign; bool whole_array = true; gfc_ref *ref; - symbol_attribute attr; gcc_assert (sym->assoc); e = sym->assoc->target; @@ -1916,9 +1915,7 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block) } } - attr = gfc_expr_attr (e); if (sym->ts.type == BT_CHARACTER && e->ts.type == BT_CHARACTER - && (attr.allocatable || attr.pointer || attr.dummy) && POINTER_TYPE_P (TREE_TYPE (se.expr))) { /* These are pointer types already. */ @@ -1926,8 +1923,8 @@ trans_associate_var (gfc_symbol *sym, gfc_wrapped_block *block) } else { - tmp = TREE_TYPE (sym->backend_decl); - tmp = gfc_build_addr_expr (tmp, se.expr); + tmp = TREE_TYPE (sym->backend_decl); + tmp = gfc_build_addr_expr (tmp, se.expr); } gfc_add_modify (&se.pre, sym->backend_decl, tmp); -- cgit v1.1