re PR c++/46160 (ICE with volatile structure and enum)
PR c++/46160 * cp-gimplify.c (cp_gimplify_expr): Drop volatile MEM_REFs on the RHS to avoid infinite recursion with gimplify_expr. * g++.dg/opt/empty2.C: New test. From-SVN: r166372
This commit is contained in:
parent
ee01a467d1
commit
897145e3e1
4 changed files with 37 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
2010-11-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/46160
|
||||
* cp-gimplify.c (cp_gimplify_expr): Drop volatile MEM_REFs
|
||||
on the RHS to avoid infinite recursion with gimplify_expr.
|
||||
|
||||
2010-11-05 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/46304
|
||||
|
|
|
@ -595,6 +595,16 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
|
|||
if (!TREE_SIDE_EFFECTS (op1)
|
||||
|| (DECL_P (op1) && TREE_THIS_VOLATILE (op1)))
|
||||
*expr_p = op0;
|
||||
else if (TREE_CODE (op1) == MEM_REF
|
||||
&& TREE_THIS_VOLATILE (op1))
|
||||
{
|
||||
/* Similarly for volatile MEM_REFs on the RHS. */
|
||||
if (!TREE_SIDE_EFFECTS (TREE_OPERAND (op1, 0)))
|
||||
*expr_p = op0;
|
||||
else
|
||||
*expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (*expr_p),
|
||||
TREE_OPERAND (op1, 0), op0);
|
||||
}
|
||||
else
|
||||
*expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (*expr_p),
|
||||
op0, op1);
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2010-11-05 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/46160
|
||||
* g++.dg/opt/empty2.C: New test.
|
||||
|
||||
PR target/45670
|
||||
* gcc.target/i386/pr45670.c: New test.
|
||||
|
||||
|
|
18
gcc/testsuite/g++.dg/opt/empty2.C
Normal file
18
gcc/testsuite/g++.dg/opt/empty2.C
Normal file
|
@ -0,0 +1,18 @@
|
|||
// PR c++/46160
|
||||
// { dg-do compile }
|
||||
|
||||
struct S
|
||||
{
|
||||
enum E { A };
|
||||
} s;
|
||||
volatile S t;
|
||||
|
||||
void f (S::E);
|
||||
|
||||
void
|
||||
g ()
|
||||
{
|
||||
volatile S *p = &s;
|
||||
f (p->A);
|
||||
f (t.A);
|
||||
}
|
Loading…
Add table
Reference in a new issue