From: Jakub Jelinek Date: Sun, 22 May 2011 19:00:00 +0000 (+0200) Subject: re PR middle-end/49029 (ICE in simplify_subreg, at simplify-rtx.c:5266) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ccb1b17ba8e94c59bbf14f8ed24d9e39377b7efb;p=gcc.git 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a022b62d23e..122e4dff57e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-05-22 Jakub Jelinek + + 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 PR target/45098 diff --git a/gcc/expmed.c b/gcc/expmed.c index 18a65929f78..5527c1e7112 100644 --- a/gcc/expmed.c +++ b/gcc/expmed.c @@ -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); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f083968b1c6..015b4fae01e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-05-22 Jakub Jelinek + + PR middle-end/49029 + * gcc.c-torture/compile/pr49029.c: New test. + 2011-05-22 Jason Merrill * g++.dg/cpp0x/sfinae23.C: New. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr49029.c b/gcc/testsuite/gcc.c-torture/compile/pr49029.c new file mode 100644 index 00000000000..ebe81b31b28 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr49029.c @@ -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); +}