mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-10 13:31:04 +08:00
re PR c++/70285 (ICE on valid code on x86_64-linux-gnu: verify_gimple failed)
PR c++/70285 * cp-gimplify.c (cp_fold) [COND_EXPR]: Handle bit-fields. From-SVN: r234384
This commit is contained in:
parent
11b6a02e91
commit
683b810150
@ -1,3 +1,8 @@
|
||||
2016-03-21 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/70285
|
||||
* cp-gimplify.c (cp_fold) [COND_EXPR]: Handle bit-fields.
|
||||
|
||||
2016-03-18 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/70139
|
||||
|
@ -2130,6 +2130,12 @@ cp_fold (tree x)
|
||||
else
|
||||
x = fold (x);
|
||||
|
||||
/* A COND_EXPR might have incompatible types in branches if one or both
|
||||
arms are bitfields. If folding exposed such a branch, fix it up. */
|
||||
if (TREE_CODE (x) != code)
|
||||
if (tree type = is_bitfield_expr_with_lowered_type (x))
|
||||
x = fold_convert (type, x);
|
||||
|
||||
break;
|
||||
|
||||
case CALL_EXPR:
|
||||
|
15
gcc/testsuite/g++.dg/other/bitfield5.C
Normal file
15
gcc/testsuite/g++.dg/other/bitfield5.C
Normal file
@ -0,0 +1,15 @@
|
||||
// PR c++/70285
|
||||
|
||||
int a;
|
||||
|
||||
struct S
|
||||
{
|
||||
int i:8;
|
||||
} b;
|
||||
|
||||
int
|
||||
fn1 (bool x)
|
||||
{
|
||||
(&fn1 ? b.i : a) = 42;
|
||||
return (&fn1 ? b.i : a);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user