On Sep 9, 2005, at 4:40 PM, Olivier Hainque wrote:
Olivier Hainque wrote:
I'm not yet clear why the call is not issued there. This is my first
dive in the gimplifier, so it might well be simple.
FWIW, I think part of the problem is that TREE_SIDE_EFFECTS is not
set on the constructor, despite the presence of a function call in
the components.
No, that is not the problem. The problem is that we gimplify the
expression for side effects but don't actually add the expression
if the gimplify put it back in the same expression.
Any ways, the following patch fixes the issue correctly.
If you could test and post the patch, that would be nice?
Thanks,
Andrew Pinski
ChangeLog:
* gimplify.c (gimplify_expr) <case CONSTRUCTOR>: Add the
expressions to a statement list instead of gimplifying them.
Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimplify.c,v
retrieving revision 2.151
diff -u -p -r2.151 gimplify.c
--- gimplify.c 6 Sep 2005 02:04:51 -0000 2.151
+++ gimplify.c 9 Sep 2005 21:22:42 -0000
@@ -4199,18 +4199,19 @@ gimplify_expr (tree *expr_p, tree *pre_p
{
unsigned HOST_WIDE_INT ix;
constructor_elt *ce;
+ tree temp = NULL_TREE;
for (ix = 0;
VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (*expr_p),
ix, ce);
ix++)
if (TREE_SIDE_EFFECTS (ce->value))
- gimplify_expr (&ce->value, pre_p, post_p,
- gimple_test_f, fallback);
+ append_to_statement_list (ce->value, &temp);
- *expr_p = NULL_TREE;
+ *expr_p = temp;
+ ret = GS_OK;
}
-
- ret = GS_ALL_DONE;
+ else
+ ret = GS_ALL_DONE;
break;
/* The following are special cases that are not handled by the