This is the mail archive of the gcc@gcc.gnu.org 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]

_Alignas attribute and HOST_BITS_PER_INT


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.

I looked at the code responsible for generating the error (c-common.c,
check_user_alignment) and found that it checks if the number of
bits in the user provided alignment is more than HOST_BITS_PER_INT -
BITS_PER_UNIT_LOG. For AVR, integer size is 16 bits, and therefore 
__INT_MAX__ is 2^15 - 1. HOST_BITS_PER_INT, however, is 32 bits, and
hence the error is not triggered.

Is it right to check against HOST_BITS_PER_INT, when the alignment
attribute only applies to the target? If the check is indeed correct,
should the test be modified to handle targets whose __INT__MAX__ is less
than 2^HOST_BITS_PER_INT - 1 ?

Regards
Senthil


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