re PR c++/93046 (ICE in cp_gimplify_init_expr)

PR c++/93046
	* cp-gimplify.c (cp_gimplify_init_expr): Don't look through
	TARGET_EXPR if it has been gimplified already.

	* g++.dg/ext/cond4.C: New test.

From-SVN: r279884
This commit is contained in:
Jakub Jelinek 2020-01-05 01:49:14 +01:00 committed by Jakub Jelinek
parent 48cb874a04
commit 72036b59a0
4 changed files with 26 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2010-01-05 Jakub Jelinek <jakub@redhat.com>
PR c++/93046
* cp-gimplify.c (cp_gimplify_init_expr): Don't look through
TARGET_EXPR if it has been gimplified already.
2020-01-03 Jason Merrill <jason@redhat.com> 2020-01-03 Jason Merrill <jason@redhat.com>
PR c++/93033 - incorrect tree node sharing with array init. PR c++/93033 - incorrect tree node sharing with array init.

View File

@ -523,7 +523,7 @@ cp_gimplify_init_expr (tree *expr_p, gimple_seq *pre_p)
think that such code never uses the TARGET_EXPR as an initializer. If think that such code never uses the TARGET_EXPR as an initializer. If
I'm wrong, we'll abort because the temp won't have any RTL. In that I'm wrong, we'll abort because the temp won't have any RTL. In that
case, I guess we'll need to replace references somehow. */ case, I guess we'll need to replace references somehow. */
if (TREE_CODE (from) == TARGET_EXPR) if (TREE_CODE (from) == TARGET_EXPR && TARGET_EXPR_INITIAL (from))
from = TARGET_EXPR_INITIAL (from); from = TARGET_EXPR_INITIAL (from);
/* If we might need to clean up a partially constructed object, break down /* If we might need to clean up a partially constructed object, break down

View File

@ -1,3 +1,8 @@
2010-01-05 Jakub Jelinek <jakub@redhat.com>
PR c++/93046
* g++.dg/ext/cond4.C: New test.
2020-01-04 Tobias Burnus <tobias@codesourcery.com> 2020-01-04 Tobias Burnus <tobias@codesourcery.com>
PR fortran/91640 PR fortran/91640

View File

@ -0,0 +1,14 @@
// PR c++/93046
// { dg-do compile }
// { dg-options "" }
struct S {
S (int);
operator bool ();
};
S
foo ()
{
return S (1) ? : S (2);
}