stor-layout.c (place_field): Update rli->offset as well as rli->bitpos.
authorRichard Sandiford <rsandifo@redhat.com>
Wed, 20 Nov 2002 10:09:01 +0000 (10:09 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 20 Nov 2002 10:09:01 +0000 (10:09 +0000)
* stor-layout.c (place_field): Update rli->offset as well as
rli->bitpos.

From-SVN: r59301

gcc/ChangeLog
gcc/stor-layout.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/bitfld-5.c [new file with mode: 0644]

index 5961678e5511c50a407fe1076a8d8056a10afe22..b644383075916a58cc2951e3aae5a39d0a55f222 100644 (file)
@@ -1,3 +1,8 @@
+2002-11-20  Richard Sandiford  <rsandifo@redhat.com>
+
+       * stor-layout.c (place_field): Update rli->offset as well as
+       rli->bitpos.
+
 2002-11-20  Richard Sandiford  <rsandifo@redhat.com>
 
        * sched-deps.c (sched_analyze): Check HARD_REGNO_CALL_PART_CLOBBERED.
index dd37d955190384e29d3087050b4bf5a80ba18240..db4c09f29f70a51732b2f0d6e719c353eeb5599e 100644 (file)
@@ -1036,6 +1036,7 @@ place_field (rli, field)
              if (rli->remaining_in_alignment < bitsize)
                {
                  /* out of bits; bump up to next 'word'.  */
+                 rli->offset = DECL_FIELD_OFFSET (rli->prev_field);
                  rli->bitpos = size_binop (PLUS_EXPR,
                                      type_size,
                                      DECL_FIELD_BIT_OFFSET(rli->prev_field));
index aef782623ad87a59eceb12957c8871bc4455bfc5..b5355d7dce62986039c9ac2517a077fc14a13db6 100644 (file)
@@ -1,3 +1,7 @@
+2002-11-20  Richard Sandiford  <rsandifo@redhat.com>
+
+       * gcc.dg/bitfld-5.c: New test.
+
 2002-11-20  Richard Sandiford  <rsandifo@redhat.com>
 
        * gcc.c-torture/execute/20021120-3.c: New test.
diff --git a/gcc/testsuite/gcc.dg/bitfld-5.c b/gcc/testsuite/gcc.dg/bitfld-5.c
new file mode 100644 (file)
index 0000000..835bbce
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-options "" } */
+#include <limits.h>
+
+struct s
+{
+  int i1 : sizeof (int) * CHAR_BIT;
+  int i2 : sizeof (int) * CHAR_BIT;
+  int i3 : sizeof (int) * CHAR_BIT;
+  int i4 : sizeof (int) * CHAR_BIT;
+};
+
+int f[sizeof (struct s) != sizeof (int) * 4 ? -1 : 1];