http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47469

           Summary: Check whether arrayfunc_assign_needs_temporary misses
                    TBP/PPC attributes
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org
                CC: pa...@gcc.gnu.org, ja...@gcc.gnu.org


Found when looking at PR 47455 and trans-expr.c:

I wonder whether for type-bound procedures or for procedure-pointer components,
the "pointer" or "allocatable" attribute is properly taken into account in
arrayfunc_assign_needs_temporary.

However, I have not checked whether this is an really and issue or whether
there are other related issues.

Thus, something like:

--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -5346,8 +5381,8 @@ arrayfunc_assign_needs_temporary (gfc_expr * expr1,
gfc_expr * expr2)
     return true;

   /* Functions returning pointers need temporaries.  */
-  if (expr2->symtree->n.sym->attr.pointer
-      || expr2->symtree->n.sym->attr.allocatable)
+  if (gfc_expr_attr (expr2).pointer
+      || gfc_expr_attr (expr2).allocatable)
     return true;

   /* Character array functions need temporaries unless the

Reply via email to