This is the mail archive of the
mailing list for the GCC project.
Re: RFC: is this test case OK?
- From: Richard Henderson <rth at redhat dot com>
- To: Gary Funck <gary at intrepid dot com>
- Cc: Gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 12 Jul 2010 08:58:01 -0700
- Subject: Re: RFC: is this test case OK?
- References: <20100712064453.GF505@intrepid.com>
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
typedef __UINTPTR_TYPE__ uintptr_t;
typedef __SIZE_TYPE__ uintptr_t;
> 3) Would it be reasonable to place this test in
> 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.