OSDN Git Service

PR middle-end/49029
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 22 May 2011 19:02:59 +0000 (19:02 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 22 May 2011 19:02:59 +0000 (19:02 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@174036 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/expmed.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr49029.c [new file with mode: 0644]

index 40b4426..1b91045 100644 (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-21  Eric Botcazou  <ebotcazou@adacore.com>
 
        * config/sparc/sparc.md (setjmp): Handle PIC mode and use the hard
index 6c35f8e..0d44b2b 100644 (file)
@@ -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
index 8b92221..4360d13 100644 (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-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 (file)
index 0000000..ebe81b3
--- /dev/null
@@ -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);
+}