------- Comment #3 from pault at gcc dot gnu dot org  2007-07-25 05:20 -------
Another sub-pr: putting the res on the rhs in parentheses does not work either.
 This can be fixed by...

$ svn diff -x -cp gcc/fortran/trans-expr.c
Index: gcc/fortran/trans-expr.c
===================================================================
*** gcc/fortran/trans-expr.c    (revision 126885)
--- gcc/fortran/trans-expr.c    (working copy)
*************** gfc_conv_variable (gfc_se * se, gfc_expr
*** 472,477 ****
--- 472,482 ----
                  || sym->attr.result))
            se->expr = build_fold_indirect_ref (se->expr);

+         /* A character with VALUE attribute needs an address
+            expression.  */
+         if (sym->attr.value)
+           se->expr = build_fold_addr_expr (se->expr);
+
        }
        else if (!sym->attr.value)
        {
*************** gfc_conv_expr_op (gfc_se * se, gfc_expr
*** 1044,1049 ****
--- 1049,1064 ----
      case INTRINSIC_UPLUS:
      case INTRINSIC_PARENTHESES:
        gfc_conv_expr (se, expr->value.op.op1);
+
+       if (expr->value.op.op1->ts.type == BT_DERIVED
+           && expr->value.op.op1->ts.derived->attr.alloc_comp)
+       {
+         tmp = gfc_evaluate_now (se->expr, &se->pre);
+         type = gfc_copy_alloc_comp (expr->value.op.op1->ts.derived, se->expr,
tmp, 0);
+         se->expr = tmp;
+         gfc_add_expr_to_block (&se->pre, type);
+       }
+
        return;

leading to a dependency check which puts res in parentheses for the primary
problem.

Paul


-- 


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

Reply via email to