re PR middle-end/49029 (ICE in simplify_subreg, at simplify-rtx.c:5266)

PR middle-end/49029
	* expmed.c (extract_fixed_bit_field): Test whether target can be used
	only after deciding which mode to use.

	* gcc.c-torture/compile/pr49029.c: New test.

From-SVN: r174034
This commit is contained in:
Jakub Jelinek 2011-05-22 21:00:00 +02:00 committed by Jakub Jelinek
parent 50ad7db2a8
commit ccb1b17ba8
4 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2011-05-22 Jakub Jelinek <jakub@redhat.com>
PR middle-end/49029
* expmed.c (extract_fixed_bit_field): Test whether target can be used
only after deciding which mode to use.
2011-05-22 Tom de Vries <tom@codesourcery.com>
PR target/45098

View File

@ -1769,8 +1769,6 @@ extract_fixed_bit_field (enum machine_mode tmode, rtx op0,
/* To extract a signed bit-field, first shift its msb to the msb of the word,
then arithmetic-shift its lsb to the lsb of the word. */
op0 = force_reg (mode, op0);
if (mode != tmode)
target = 0;
/* Find the narrowest integer mode that contains the field. */
@ -1782,6 +1780,9 @@ extract_fixed_bit_field (enum machine_mode tmode, rtx op0,
break;
}
if (mode != tmode)
target = 0;
if (GET_MODE_BITSIZE (mode) != (bitsize + bitpos))
{
int amount = GET_MODE_BITSIZE (mode) - (bitsize + bitpos);

View File

@ -1,3 +1,8 @@
2011-05-22 Jakub Jelinek <jakub@redhat.com>
PR middle-end/49029
* gcc.c-torture/compile/pr49029.c: New test.
2011-05-22 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/sfinae23.C: New.

View File

@ -0,0 +1,10 @@
/* PR middle-end/49029 */
struct S { volatile unsigned f : 11; signed g : 30; } __attribute__((packed));
struct T { volatile struct S h; } __attribute__((packed)) a;
void foo (int);
void
bar ()
{
foo (a.h.g);
}