This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: is this test case OK?

On 07/11/2010 11:44 PM, Gary Funck wrote:
> Recently, I ran into a bug in the merge of the trunck with the
> gupc branch: a statement in c-typeck.c in the trunk had inadvertently
> been deleted, and this caused a regression on IA64.
> The attached test case detects the regression (that user-requested
> 16 byte alignment is handled correctly).  I'll follow-up with an RFA
> if this test case is considered well-formed, useful, and not duplicative.
> Three questions:
> 1) Is the use of __alignof__ acceptable?


> 2) Is the cast of an address to (unsigned long int)
> suitably portable?  If not, is there another recommended
> method for making this check?

Canonically uintptr_t, but that's not available on all targets.
Try something like

#ifdef __UINTPTR_TYPE__
typedef __UINTPTR_TYPE__ uintptr_t;
typedef __SIZE_TYPE__ uintptr_t;

> 3) Would it be reasonable to place this test in
> testsuite/gcc.dg?


> I'm concerned that the final 'if' which tests that the address
> is 16 byte aligned might not be portable enough across all
> targets.  For example, does a 16 bit word target processor
> have to honor the 16 byte alignment, or is it a "best efforts"
> sort of thing?

All elf targets should honor it; some coff and a.out targets cannot.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]