From: Eric Botcazou Date: Wed, 15 Dec 2004 19:17:57 +0000 (+0000) Subject: re PR c++/17972 (const/pure functions result in bad asm) X-Git-Tag: releases/gcc-3.4.4~405 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f67254bef2578549f383aabdc379c6d1731822e1;p=thirdparty%2Fgcc.git re PR c++/17972 (const/pure functions result in bad asm) PR c++/17972 * tree-inline.c (expand_call_inline): Set TREE_SIDE_EFFECTS on the STMT_EXPR wrapping up the inlined body. From-SVN: r92213 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fd71366ccf09..6da3a6a9dfe9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-12-15 Eric Botcazou + + PR c++/17972 + * tree-inline.c (expand_call_inline): Set TREE_SIDE_EFFECTS + on the STMT_EXPR wrapping up the inlined body. + 2004-12-15 Eric Botcazou PR preprocessor/15167 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 47e6a846af16..f15e3660a6d1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2004-12-15 Alan Modra + + * g++.dg/opt/inline9.C: New test. + 2004-12-15 Eric Botcazou * cpp/pragma-once-1.c: New test. diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 8110b02e3d4b..ccc49e783798 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -1548,8 +1548,11 @@ expand_call_inline (tree *tp, int *walk_subtrees, void *data) splay_tree_delete (id->decl_map); id->decl_map = st; - /* The new expression has side-effects if the old one did. */ - TREE_SIDE_EFFECTS (expr) = TREE_SIDE_EFFECTS (t); + /* Although, from the semantic viewpoint, the new expression has + side-effects only if the old one did, it is not possible, from + the technical viewpoint, to evaluate the body of a function + multiple times without serious havoc. */ + TREE_SIDE_EFFECTS (expr) = 1; /* Replace the call by the inlined body. Wrap it in an EXPR_WITH_FILE_LOCATION so that we'll get debugging line notes