Commit effed655 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/13239 (Assertion does not seem to work correctly anymore)

	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: r74832
parent c05fc0c2
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
......
......@@ -4460,6 +4460,14 @@ expand_builtin_expect_jump (tree exp, rtx if_false_label, rtx 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
......
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.
......
// 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);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment