]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/13239 (Assertion does not seem to work correctly anymore)
authorJakub Jelinek <jakub@redhat.com>
Fri, 19 Dec 2003 13:54:37 +0000 (14:54 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 19 Dec 2003 13:54:37 +0000 (14:54 +0100)
PR c++/13239
* builtins.c (expand_builtin_expect_jump): Update
TREE_VALUE (arglist) if unsave_expr_now langhook
created a new tree.

* g++.dg/opt/expect1.C: New test.

From-SVN: r74834

gcc/ChangeLog
gcc/builtins.c
gcc/testsuite/ChangeLog

index fad113e9d744d5d5205f1b74fb4e58a4998b8166..0365ba41fe305f3a748dd81e2eb10300fe98b4a6 100644 (file)
@@ -1,3 +1,10 @@
+2003-12-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/13239
+       * builtins.c (expand_builtin_expect_jump): Update
+       TREE_VALUE (arglist) if unsave_expr_now langhook
+       created a new tree.
+
 2003-12-18  Mark Mitchell  <mark@codesourcery.com>
 
        * config/sol2.h (LINK_ARCH32_SPEC): Define in terms of ...
index d0882740e38519fe3f812f3a12aa2b3f097bcf37..c82165f44595d39dcec49a5c798f0678d06d8acf 100644 (file)
@@ -3688,6 +3688,14 @@ expand_builtin_expect_jump (exp, if_false_label, if_true_label)
       ret = get_insns ();
       end_sequence ();
 
+      /* For mildly unsafe builtin jump's, if unsave_expr_now
+        creates a new tree instead of changing the old one
+        TREE_VALUE (arglist) needs to be updated.  */
+      if (arg0 != TREE_VALUE (arglist)
+         && TREE_CODE (arg0) == UNSAVE_EXPR
+         && TREE_OPERAND (arg0, 0) != TREE_VALUE (arglist))
+       TREE_VALUE (arglist) = TREE_OPERAND (arg0, 0);
+
       /* Now that the __builtin_expect has been validated, go through and add
         the expect's to each of the conditional jumps.  If we run into an
         error, just give up and generate the 'safe' code of doing a SCC
index 8291482ffc59a09b490b265129451f9156ba3c0f..9c7cab82cab19c30c8673b98e28a71eb51e8707f 100644 (file)
@@ -1,3 +1,8 @@
+2003-12-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/13239
+       * g++.dg/opt/expect1.C: New test.
+
 2003-12-18  Kriang Lerdsuwanakij  <lerdsuwa@users.sourceforge.net>
 
        PR c++/13262