On Wed, 27 Mar 2013, Senthil Kumar Selvaraj wrote:

> Hi,
> 
> I was looking at why gcc.dg/c1x-align-3.c (test for errors, line 15) is
> failing for the AVR target, and I found that the test expects _Alignas
> with -__INT_MAX__ - 1 to fail with a "too large" error.

It expects either an error either about being too large, or about not 
being a power of 2.

> Is it right to check against HOST_BITS_PER_INT, when the alignment

A check against HOST_BITS_PER_INT would be because of code inside GCC that 
uses host "int" to store alignment values.  Ideally there wouldn't be such 
code - ideally any alignment up to and including the size of the whole 
target address space could be used.  (For example, alignments could always 
be represented internally as a base-2 log.)  But given the existence of 
such code, such a check is needed.

However, a size that is not a power of 2 (such as this one, minus a power 
of 2) should still be detected and get an error that this test accepts, 
whether or not that size is also too large for host int.  So look at why 
you don't get the "requested alignment is not a power of 2" error for this 
code with a negative alignment.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to