diff options
author | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-08-26 08:51:35 +0000 |
---|---|---|
committer | nathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-08-26 08:51:35 +0000 |
commit | 314216bfa5b836f0df9af4b9768b82f405c5d333 (patch) | |
tree | 152ffb66aceabfdd630712ed76616a8b76fb2e82 /gcc/tree.c | |
parent | c8a8ab0fd0affa18cad8ef37b54020d62623d45e (diff) | |
download | gcc-314216bfa5b836f0df9af4b9768b82f405c5d333.tar.gz |
* builtins.c (build_function_call_expr): Don't set
TREE_SIDE_EFFECTS here.
* expr.c (emit_block_move_via_libcall): Likewise.
(clear_storage_via_libcall): Likewise.
* tree.c (build): Set TREE_SIDE_EFFECTS for non-const, non-pure
CALL_EXPRs.
cp:
* call.c (build_call): Don't set TREE_SIDE_EFFECTS here.
(build_new_method_call): Add goto finish.
* semantics.c (simplify_aggr_init_exprs_r): Don't set
TREE_SIDE_EFFECTS on a call.
testsuite:
* c++.dg/warn/noeffect3.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70802 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c index a12df1cb9f0..df074e85510 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -2378,6 +2378,17 @@ build (enum tree_code code, tree tt, ...) va_end (p); TREE_CONSTANT (t) = constant; + + if (code == CALL_EXPR && !TREE_SIDE_EFFECTS (t)) + { + /* 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))) + TREE_SIDE_EFFECTS (t) = 1; + } + return t; } |