summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-05-22 21:02:59 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2011-05-22 21:02:59 +0200
commitbba3a46ec2abdcf42113873f1c990ffcd869ddc3 (patch)
tree6f3e5930c61bd6265fca63c7ef9d5f2305cfc8bb
parent603057618384112ca847168c9bcc63fb1b9ac31e (diff)
downloadgcc-bba3a46ec2abdcf42113873f1c990ffcd869ddc3.tar.gz
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: r174036
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/expmed.c5
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr49029.c10
4 files changed, 24 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 40b44267163..1b91045304d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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-21 Eric Botcazou <ebotcazou@adacore.com>
* config/sparc/sparc.md (setjmp): Handle PIC mode and use the hard
diff --git a/gcc/expmed.c b/gcc/expmed.c
index 6c35f8eb4b4..0d44b2b4d54 100644
--- a/gcc/expmed.c
+++ b/gcc/expmed.c
@@ -1875,8 +1875,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. */
@@ -1888,6 +1886,9 @@ extract_fixed_bit_field (enum machine_mode tmode, rtx op0,
break;
}
+ if (mode != tmode)
+ target = 0;
+
if (GET_MODE_BITSIZE (mode) != (bitsize + bitpos))
{
tree amount
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8b92221e57b..4360d132eae 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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-20 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/constexpr-static7.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);
+}