re PR c++/57793 (ICE with bitfields in get_bit_range)
PR c++/57793 * expr.c (get_inner_reference): Avoid returning a negative bitpos. From-SVN: r200862
This commit is contained in:
parent
b43e512e9c
commit
7e7bed5387
|
@ -1,3 +1,8 @@
|
|||
2013-07-09 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/57793
|
||||
* expr.c (get_inner_reference): Avoid returning a negative bitpos.
|
||||
|
||||
2013-07-09 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* config/rs6000/rs6000.c (rs6000_init_hard_regno_mode_ok): Only
|
||||
|
|
|
@ -6698,7 +6698,7 @@ get_inner_reference (tree exp, HOST_WIDE_INT *pbitsize,
|
|||
? 3 : exact_log2 (BITS_PER_UNIT),
|
||||
HOST_BITS_PER_DOUBLE_INT, true);
|
||||
tem = double_int_add (tem, bit_offset);
|
||||
if (double_int_fits_in_shwi_p (tem))
|
||||
if (double_int_fits_in_shwi_p (tem) && !double_int_negative_p (tem))
|
||||
{
|
||||
*pbitpos = double_int_to_shwi (tem);
|
||||
*poffset = offset = NULL_TREE;
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/* PR c++/57793 */
|
||||
|
||||
struct A { unsigned a : 1; unsigned b : 1; };
|
||||
struct B
|
||||
{
|
||||
unsigned char c[0x40000000];
|
||||
unsigned char d[0x40000ff0];
|
||||
struct A e;
|
||||
};
|
||||
|
||||
void *foo (struct B *p)
|
||||
{
|
||||
if (p->e.a)
|
||||
return (void *) 0;
|
||||
p->e.b = 1;
|
||||
return p->c;
|
||||
}
|
||||
|
||||
void
|
||||
bar (struct B *p)
|
||||
{
|
||||
foo (p);
|
||||
}
|
Loading…
Reference in New Issue