This is the mail archive of the
mailing list for the GCC project.
Re: Test gcc.c-torture/execute/align-3.c
- From: Geoff Keating <geoffk at apple dot com>
- To: sje at cup dot hp dot com
- Cc: GCC List <gcc at gcc dot gnu dot org>
- Date: Wed, 11 Jul 2007 16:57:43 -0700
- Subject: Re: Test gcc.c-torture/execute/align-3.c
- References: <200707112348.QAA13685@hpsje.cup.hp.com>
On 11/07/2007, at 4:48 PM, Steve Ellcey wrote:
The test gcc.c-torture/execute/align-3.c is failing on most of my
platforms, including IA64 HP-UX and Linux. The test consists of:
void func(void) __attribute__((aligned(256)));
if (((long)func & 0xFF) != 0)
if (__alignof__(func) != 256)
The problem I am having is with the first test, checking that the
address of func is aligned. The problem is that using func in this
on IA64 gives me the address of the function descriptor, not the
of the function itself. And while the function address does appear to
be aligned on a 256 byte boundry, the function descriptor has its
8 byte alignment. My question is, should function descriptors have
same alignment as functions or is this just an invalid test on systems
that use function descriptors?
I knew there was a reason that first test wouldn't work on some
platform, it seemed too good to be true.
The compiler understands that a pointer-to-function need not actually
have the same low bits clear as the address of the function itself, so
it's OK for the descriptor to not be aligned as much as the function
to which it points.
Feel free to either (a) #ifdef out the first part of the test on IA64,
or (b) delete the first part of the test altogether.