* stor-layout.c (place_field): Update rli->offset as well as
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Nov 2002 10:09:01 +0000 (10:09 +0000)
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 20 Nov 2002 10:09:01 +0000 (10:09 +0000)
rli->bitpos.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59301 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 5961678..b644383 100644 (file)
@@ -1,5 +1,10 @@
 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.
 
 2002-11-20  Richard Sandiford  <rsandifo@redhat.com>
index dd37d95..db4c09f 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 aef7826..b5355d7 100644 (file)
@@ -1,5 +1,9 @@
 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.
 
 2002-11-20  Richard Sandiford  <rsandifo@redhat.com>
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];