* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74832
138bc75d-0d04-0410-961f-
82ee72b054a4
+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-19 Richard Earnshaw <rearnsha@arm.com>
* arm.c (thumb_base_register_rtx_p): Use regno in comparison against
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
+2003-12-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/13239
+ * g++.dg/opt/expect1.C: New test.
+
2003-12-19 Hartmut Penner <hpenner@de.ibm.com>
* gcc.dg/altivec-varargs-1.c: Enable testcase on ppc linux.
--- /dev/null
+// PR c++/13239
+// { dg-do run }
+// { dg-options "-O2" }
+
+extern "C" void abort (void);
+
+struct Y {
+ int i;
+};
+
+bool foo () { return true; }
+Y bar () { Y y = {0}; return y; }
+
+int main ()
+{
+ __builtin_expect (foo () && (bar ().i) == 0, 0) ? 0 : (abort (), 1);
+}