RFA: M32C: Do not enable PCC_BITFIELD_TYPE_MATTERS
Nick Clifton
nickc@redhat.com
Thu Feb 5 17:43:00 GMT 2009
Hi DJ,
Here is another small m32c patch for your consideration.
This time the problem is that several gcc tests are reporting a
warning message along the lines of:
Offset of packed bit-field [...] has changed in GCC 4.4
This warning is only significant for targets which use PCC style
bitfield alignment where the type of the field affects the alignment
of the field. Since the M32C only uses 8-bit alignment for all
types, the type of a bitfield is not actually significant and it is
safe for PCC_BITFIELD_TYPE_MATTERS to be set to 0. (It is set to 1
by default in gcc/config/elfos.h).
Note - in theory this warning message is expected in the gcc tests
since they check the pcc_bitfield_type_matters proc. Eg from
gcc.dg/bitfld-15.c:
/* { dg-message "note: Offset of packed bit-field 'b' has changed in GCC 4.4" "" { target pcc_bitfield_type_matters } } */
In practice however this does not work for the M32C port because the
pcc_bitfield_type_matters proc does not detect that the M32C port
(currently) has PCC_BITFIELD_TYPE_MATTERS enabled. This is because
the test in the proc:
struct foo1 { char x; char :0; char y; };
struct foo2 { char x; int :0; char y; };
int s[sizeof (struct foo1) != sizeof (struct foo2) ? 1 : -1];
Assumes that the alignment of the "int" type is greater than the
alignment of the "char" type.
So - another way to fix the gcc testsuite failures would be to
extend the pcc_bitfield_type_matters proc to add a special check for
the m32c target. I think that this is a lesser solution because a)
there is no need for PCC_BITFIELD_TYPE_MATTERS to be defined for the
M32C and b) if it remains defined then users might run into these
warning messages themselves.
OK to apply ?
Cheers
Nick
gcc/ChangeLog
2009-02-05 Nick Clifton <nickc@redhat.com>
* config/m32c/m32c.h (PCC_BITFIELD_TYPE_MATTERS): Define to
zero.
Index: gcc/config/m32c/m32c.h
===================================================================
--- gcc/config/m32c/m32c.h (revision 143953)
+++ gcc/config/m32c/m32c.h (working copy)
@@ -154,6 +165,11 @@
#define FUNCTION_BOUNDARY 8
#define BIGGEST_ALIGNMENT 8
+/* Since we have a maximum structure alignment of 8 there
+ is no need to enforce any alignment of bitfield types. */
+#undef PCC_BITFIELD_TYPE_MATTERS
+#define PCC_BITFIELD_TYPE_MATTERS 0
+
#define STRICT_ALIGNMENT 0
#define SLOW_BYTE_ACCESS 1
More information about the Gcc-patches
mailing list