aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2003-11-14 03:19:59 -0500
committerJason Merrill <jason@gcc.gnu.org>2003-11-14 03:19:59 -0500
commitf027e0a2a2067052c2e0a4782f24728125fa4da8 (patch)
tree5537fc814587dbdb7ede402625d46e737bc763c9 /gcc/tree.c
parent33552225d09e3b71b9bc640b4badf17bc731144d (diff)
downloadgcc-f027e0a2a2067052c2e0a4782f24728125fa4da8.zip
gcc-f027e0a2a2067052c2e0a4782f24728125fa4da8.tar.gz
gcc-f027e0a2a2067052c2e0a4782f24728125fa4da8.tar.bz2
re PR middle-end/12526 ([tree-ssa] internal compiler error: Segmentation fault)
PR middle-end/12526 * tree.c (build): A CALL_EXPR has side-effects if its arguments do. * calls.c (call_expr_flags): New fn. * tree.h: Declare it. From-SVN: r73589
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 66e0afd..8466990 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2294,6 +2294,7 @@ build (enum tree_code code, tree tt, ...)
int fro;
int constant;
va_list p;
+ tree node;
va_start (p, tt);
@@ -2380,10 +2381,17 @@ build (enum tree_code code, tree tt, ...)
{
/* Calls have side-effects, except those to const or
pure functions. */
- tree fn = get_callee_fndecl (t);
-
- if (!fn || (!DECL_IS_PURE (fn) && !TREE_READONLY (fn)))
+ i = call_expr_flags (t);
+ if (!(i & (ECF_CONST | ECF_PURE)))
TREE_SIDE_EFFECTS (t) = 1;
+
+ /* And even those have side-effects if their arguments do. */
+ else for (node = TREE_OPERAND (t, 1); node; node = TREE_CHAIN (node))
+ if (TREE_SIDE_EFFECTS (TREE_VALUE (node)))
+ {
+ TREE_SIDE_EFFECTS (t) = 1;
+ break;
+ }
}
return t;