rx.c (rx_is_ms_bitfield_layout): Return false if the record is packed.
authorNick Clifton <nickc@gcc.gnu.org>
Tue, 16 Nov 2010 09:40:02 +0000 (09:40 +0000)
committerNick Clifton <nickc@gcc.gnu.org>
Tue, 16 Nov 2010 09:40:02 +0000 (09:40 +0000)
* config/rx/rx.c (rx_is_ms_bitfield_layout): Return false if the
record is packed.

* gcc.target/rx/pack.c: New test.

From-SVN: r166793

gcc/ChangeLog
gcc/config/rx/rx.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/rx/pack.c [new file with mode: 0644]

index 3dd820383918f005e8e11428b3cfc1f3742ffabe..f55283ec6bd3f859e45ce4696640c00f05035a83 100644 (file)
@@ -1,3 +1,8 @@
+2010-11-16  Nick Clifton  <nickc@redhat.com>
+
+       * config/rx/rx.c (rx_is_ms_bitfield_layout): Return false if the
+       record is packed.
+
 2010-11-15  Richard Henderson  <rth@redhat.com>
 
        * fold-const.c (operand_equal_for_comparison_p): Handle FMA_EXPR,
index 968d65f2f7e9f4d3fb4cc7c1a8f27588cbae914e..771d6456a031cc16f62da3f863116f935fa1064a 100644 (file)
@@ -2306,7 +2306,8 @@ rx_file_start (void)
 static bool
 rx_is_ms_bitfield_layout (const_tree record_type ATTRIBUTE_UNUSED)
 {
-  return TRUE;
+  /* The packed attribute overrides the MS behaviour.  */
+  return ! TYPE_PACKED (record_type);
 }
 
 /* Try to generate code for the "isnv" pattern which inserts bits
index f6b4acabc73ec8912219a17e6f7929f1986e3530..ee1bcceb8e46e3a83c434a23da0b3a6689dc08f0 100644 (file)
@@ -1,3 +1,7 @@
+2010-11-16  Nick Clifton  <nickc@redhat.com>
+
+       * gcc.target/rx/pack.c: New test.
+
 2010-11-15  Richard Henderson  <rth@redhat.com>
 
        * gcc.dg/torture/builtin-math-2.c: Split out fma tests...
 
        * objc.dg/property/at-property-21.m: New.
        * objc.dg/property/at-property-22.m: New.
-       * objc.dg/property/at-property-23.m: New.       
+       * objc.dg/property/at-property-23.m: New.
        * objc.dg/property/synthesize-9.m: New.
        * objc.dg/property/synthesize-10.m: New.
-       * objc.dg/property/synthesize-11.m: New.        
+       * objc.dg/property/synthesize-11.m: New.
        * obj-c++.dg/property/at-property-21.mm: New.
        * obj-c++.dg/property/at-property-22.mm: New.
-       * obj-c++.dg/property/at-property-23.mm: New.   
+       * obj-c++.dg/property/at-property-23.mm: New.
        * obj-c++.dg/property/synthesize-9.mm: New.
        * obj-c++.dg/property/synthesize-10.mm: New.
-       * obj-c++.dg/property/synthesize-11.mm: New.    
+       * obj-c++.dg/property/synthesize-11.mm: New.
 
        * objc.dg/property/at-property-4.m: Updated to match new compiler
        where some errors have been converted into warnings and vice versa.
        * obj-c++.dg/property/at-property-16.mm: Same change.
        * obj-c++.dg/property/at-property-18.mm: Same change.
        * obj-c++.dg/property/property-neg-5.mm: Same change.
-       
+
        * obj-c++.dg/property/dynamic-2.mm: Enable tests that were
        commented out because of testsuite problems; I found out that
        using dg-warning instead of dg-message gets them to work.
        * obj-c++.dg/property/property-neg-3.mm: Same change.
        * obj-c++.dg/property/synthesize-6.mm: Same change.
-       * obj-c++.dg/property/at-property-5.mm: Same change.    
-       * obj-c++.dg/property/at-property-14.mm: Same change.   
+       * obj-c++.dg/property/at-property-5.mm: Same change.
+       * obj-c++.dg/property/at-property-14.mm: Same change.
        * obj-c++.dg/property/at-property-18.mm: Same change.
        * obj-c++.dg/property/at-property-16.mm: Same change (in this file,
        some tests still do not work due to some other testsuite issue).
        Test various valid uses of typedef with Objective-C objects and
        protocols instead.
        * objc.dg/invalid-type-1.m: New.
-       * obj-c++.dg/invalid-type-1.m: New.     
-       
+       * obj-c++.dg/invalid-type-1.m: New.
+
 2010-11-13  Iain Sandoe  <iains@gcc.gnu.org>
 
        * gcc.dg/darwin-segaddr.c: New test for multiple argument c/l switch.
            Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/46325
-       * gfortran.dg/char_initialiser_actual.f90: Make test case valid. 
+       * gfortran.dg/char_initialiser_actual.f90: Make test case valid.
 
 2010-11-11  Jan Hubicka  <jh@suse.cz>
 
 2010-11-11  Nicola Pero  <nicola.pero@meta-innovation.com>
 
        * objc.dg/property/at-property-20.m: New.
-       * objc.dg/property/synthesize-8.m: New. 
+       * objc.dg/property/synthesize-8.m: New.
        * obj-c++.dg/property/at-property-20.m: New.
        * obj-c++.dg/property/synthesize-8.mm: New.
-       
+
 2010-11-11  Joseph Myers  <joseph@codesourcery.com>
 
        * gcc.dg/cpp/warn-normalized-3.c: Update expected note text.
diff --git a/gcc/testsuite/gcc.target/rx/pack.c b/gcc/testsuite/gcc.target/rx/pack.c
new file mode 100644 (file)
index 0000000..97c44f0
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do run } */
+
+typedef unsigned short INT16U;
+
+typedef struct tst_2
+{
+  INT16U       f0;     // [+0]
+  INT16U *     f1;     // [+2]
+  INT16U       f2;     // [+6]
+  INT16U *     f3;     // [+8]
+} __attribute__ ((__packed__)) t2;
+
+#include <stddef.h>
+#include <stdlib.h>
+
+int main (void)
+{
+  if (offsetof (t2, f1) != 2)
+    abort ();
+  if (offsetof (t2, f2) != 6)
+    abort ();
+  if (offsetof (t2, f3) != 8)
+    abort ();
+  exit (0);
+}