re PR tree-optimization/71104 (ICE: verify_ssa failed (with vfork / error: definition in block 3 does not dominate use in block 7 ))

2016-07-13  Richard Biener  <rguenther@suse.de>

	PR middle-end/71104
	* gimplify.c (gimplify_modify_expr): Gimplify the RHS before
	gimplifying the LHS.  Make sure to gimplify a returning twice
	call LHS without using SSA names.

	* gcc.dg/pr71104-1.c: New testcase.
	* gcc.dg/pr71104-2.c: Likewise.

From-SVN: r238287
This commit is contained in:
Richard Biener 2016-07-13 08:03:04 +00:00 committed by Richard Biener
parent 4a0e3b5ac3
commit 7f15b177ba
5 changed files with 48 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2016-07-13 Richard Biener <rguenther@suse.de>
PR middle-end/71104
* gimplify.c (gimplify_modify_expr): Gimplify the RHS before
gimplifying the LHS. Make sure to gimplify a returning twice
call LHS without using SSA names.
2016-07-12 Trevor Saunders <tbsaunde+gcc@tbsaunde.org>
* tree-data-ref.c (find_data_references_in_stmt): Remove

View File

@ -4810,7 +4810,19 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
return ret;
/* Then gimplify the LHS. */
/* If we gimplified the RHS to a CALL_EXPR and that call may return
twice we have to make sure to gimplify into non-SSA as otherwise
the abnormal edge added later will make those defs not dominate
their uses.
??? Technically this applies only to the registers used in the
resulting non-register *TO_P. */
bool saved_into_ssa = gimplify_ctxp->into_ssa;
if (saved_into_ssa
&& TREE_CODE (*from_p) == CALL_EXPR
&& call_expr_flags (*from_p) & ECF_RETURNS_TWICE)
gimplify_ctxp->into_ssa = false;
ret = gimplify_expr (to_p, pre_p, post_p, is_gimple_lvalue, fb_lvalue);
gimplify_ctxp->into_ssa = saved_into_ssa;
if (ret == GS_ERROR)
return ret;

View File

@ -1,3 +1,9 @@
2016-07-13 Richard Biener <rguenther@suse.de>
PR middle-end/71104
* gcc.dg/pr71104-1.c: New testcase.
* gcc.dg/pr71104-2.c: Likewise.
2016-07-12 Michael Meissner <meissner@linux.vnet.ibm.com>
PR target/71805

View File

@ -0,0 +1,11 @@
/* { dg-do compile } */
void foo(void);
int vfork(void);
int *p;
void bar(void)
{
foo();
*p = vfork();
}

View File

@ -0,0 +1,12 @@
/* { dg-do compile } */
struct Foo { char c[1024]; };
void foo(void);
struct Foo baz(void) __attribute__((returns_twice));
struct Foo *p;
void bar(void)
{
foo();
*p = baz();
}