This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix g++.dg/abi/empty6.C failure for BIGGEST_ALIGNMENT <= 32 targets
- From: Joern Rennecke <joern dot rennecke at superh dot com>
- To: gcc-patches at gcc dot gnu dot org, Janis Johnson <janis187 at us dot ibm dot com>
- Cc: Mark Mitchell <mark at codesourcery dot com>
- Date: Tue, 03 Jun 2003 18:45:31 +0100
- Subject: Fix g++.dg/abi/empty6.C failure for BIGGEST_ALIGNMENT <= 32 targets
- Organization: SuperH UK Ltd.
--
--------------------------
SuperH (UK) Ltd.
2410 Aztec West / Almondsbury / BRISTOL / BS32 4QX
T:+44 1454 465658
SH1..SH4 has a BIGGEST_ALIGNEMNT of 32 bit, so if a class definition
does not demand a larger alignment, an offset of 32 bit
gets split into a DECL_FIELD_OFFSET of 4 bytes
and a DECL_FIELD_BIT_OFFSET of 0 bits.
Thus, DECL_FIELD_OFFSET and byte_position are the same for field a
in struct B of g++.dg/abi/empty6.C , so no warning about ABI compliance
is emitted.
This can be simply rectified by aligning B to something larger than 32 bit.
2003-06-03 J"orn Rennecke <joern.rennecke@superh.com>
* g++.dg/abi/empty6.C (B): Request alignment of 8 bytes.
Index: empty6.C
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/g++.dg/abi/empty6.C,v
retrieving revision 1.1
diff -p -r1.1 empty6.C
*** empty6.C 25 Sep 2002 19:07:35 -0000 1.1
--- empty6.C 3 Jun 2003 17:31:49 -0000
*************** struct A {};
*** 5,8 ****
struct B {
A a; // { dg-warning "empty" }
virtual void f () {}
! };
--- 5,8 ----
struct B {
A a; // { dg-warning "empty" }
virtual void f () {}
! } __attribute__((aligned(8)));