PATCH: fortran/25619: temporary array of constant size character type goes wrong

H. J. Lu hjl@lucon.org
Tue Apr 4 00:49:00 GMT 2006


When we copy temporary character array, we always deference the
result even if it shouldn't be deferenced. This patch checks if
the result is a pointer before deferencing it.


H.J.
 --
2006-04-03  H.J. Lu  <hongjiu.lu@intel.com>

	PR fortran/25619
	* trans-array.c (gfc_conv_expr_descriptor): Only dereference
	character pointer when copying temporary.

--- gcc/fortran/trans-array.c.assumed	2006-04-02 10:50:34.000000000 -0700
+++ gcc/fortran/trans-array.c	2006-04-03 17:45:51.000000000 -0700
@@ -4022,7 +4022,8 @@ gfc_conv_expr_descriptor (gfc_se * se, g
       if (expr->ts.type == BT_CHARACTER)
 	{
 	  gfc_conv_expr (&rse, expr);
-	  rse.expr = build_fold_indirect_ref (rse.expr);
+	  if (POINTER_TYPE_P (TREE_TYPE (rse.expr)))
+	    rse.expr = build_fold_indirect_ref (rse.expr);
 	}
       else
         gfc_conv_expr_val (&rse, expr);



More information about the Gcc-patches mailing list