* stor-layout.c (update_alignment_for_field): Respect
DECL_USER_ALIGN for zero-length bitfields, too.
* c-decl.c (finish_struct): Don't set DECL_ALIGN for normal
fields.
* cp/class.c (check_field_decl): Don't set DECL_ALIGN.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65103
138bc75d-0d04-0410-961f-
82ee72b054a4
+2003-03-31 Jason Merrill <jason@redhat.com>
+
+ PR java/10145
+ * stor-layout.c (update_alignment_for_field): Respect
+ DECL_USER_ALIGN for zero-length bitfields, too.
+ * c-decl.c (finish_struct): Don't set DECL_ALIGN for normal
+ fields.
+
2003-03-31 Matt Austern <austern@apple.com>
* cpppch.c (struct cpp_savedstate): Add defs and n_defs members.
}
}
- else if (TREE_TYPE (x) != error_mark_node)
- {
- unsigned int min_align = (DECL_PACKED (x) ? BITS_PER_UNIT
- : TYPE_ALIGN (TREE_TYPE (x)));
-
- /* Non-bit-fields are aligned for their type, except packed
- fields which require only BITS_PER_UNIT alignment. */
- DECL_ALIGN (x) = MAX (DECL_ALIGN (x), min_align);
- if (! DECL_PACKED (x))
- DECL_USER_ALIGN (x) |= TYPE_USER_ALIGN (TREE_TYPE (x));
- }
-
DECL_INITIAL (x) = 0;
/* Detect flexible array member in an invalid context. */
+2003-03-31 Jason Merrill <jason@redhat.com>
+
+ PR java/10145
+ * class.c (check_field_decl): Don't set DECL_ALIGN.
+
2003-03-30 Mark Mitchell <mark@codesourcery.com>
PR c++/7647
cp_error_at ("multiple fields in union `%T' initialized");
*any_default_members = 1;
}
-
- /* Non-bit-fields are aligned for their type, except packed fields
- which require only BITS_PER_UNIT alignment. */
- DECL_ALIGN (field) = MAX (DECL_ALIGN (field),
- (DECL_PACKED (field)
- ? BITS_PER_UNIT
- : TYPE_ALIGN (TREE_TYPE (field))));
- if (! DECL_PACKED (field))
- DECL_USER_ALIGN (field) |= TYPE_USER_ALIGN (TREE_TYPE (field));
}
/* Check the data members (both static and non-static), class-scoped
{
/* A zero-length bit-field affects the alignment of the next
field. */
- if (!DECL_PACKED (field) && integer_zerop (DECL_SIZE (field)))
+ if (!DECL_PACKED (field) && !user_align
+ && integer_zerop (DECL_SIZE (field)))
{
desired_align = TYPE_ALIGN (type);
#ifdef ADJUST_FIELD_ALIGN
--- /dev/null
+// PR java/10145
+// Test that requesting an alignment of 1 does not increase the alignment
+// of a long long field.
+
+// { dg-do run }
+
+struct A
+{
+ char c;
+ long long i;
+};
+
+struct B
+{
+ char c;
+ long long i __attribute ((__aligned__ (1)));
+};
+
+int main ()
+{
+ if (sizeof (struct A) != sizeof (struct B))
+ abort ();
+ return 0;
+}