]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/17972 (const/pure functions result in bad asm)
authorEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 15 Dec 2004 19:17:57 +0000 (19:17 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 15 Dec 2004 19:17:57 +0000 (19:17 +0000)
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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/tree-inline.c

index fd71366ccf0966a2bcccba1924f9813a66c028a3..6da3a6a9dfe99ec5409932614f3e780373863024 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-15  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       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  <ebotcazou@libertysurf.fr>
 
        PR preprocessor/15167
index 47e6a846af1611ce79d01bb59cbcfb088b3c2a4d..f15e3660a6d199a917ba3bd49185c69fce53feab 100644 (file)
@@ -1,3 +1,7 @@
+2004-12-15  Alan Modra  <amodra@bigpond.net.au>
+
+       * g++.dg/opt/inline9.C: New test.
+
 2004-12-15  Eric Botcazou  <ebotcazou@libertysurf.fr>
 
        * cpp/pragma-once-1.c: New test.
index 8110b02e3d4b0b1140825e7fd39b906d593385c4..ccc49e78379823c32161dc292a89319a91791ec7 100644 (file)
@@ -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