On 3/24/19 6:21 PM, Martin Sebor wrote:
> The error issued when the aligned attribute argument is too big
> to be represented is incorrect: it says the maximum alignment
> is 1U << 31 when it should actually be 1 << 28.  This was a typo
> introduced when the error message was enhanced earlier in GCC 9.
> 
> The test I added to verify the fix for the typo exposed another
> bug introduced in the same commit as the incorrect value in
> the error message: assuming that the attribute aligned argument
> fits in SHWI.
> 
> The attached patch corrects both problems.  It has been tested
> on x86_64-linux.  I will commit it as obvious sometime this week
> unless there are any objections or suggestions for changes.
> 
> Martin
> 
> PS I have a couple of questions related to the affected code:
> 1) Does GCC support building with compilers where int is not 32
>    bits wide, or where BITS_PER_UNIT is not 3? (I.e., either is
>    less or more?)
> 2) Is there a supported target that doesn't have __INT64_TYPE__?
>    (And if so, how do I find it in a test?  I couldn't find
>    anythhing in target-supports.exp).
> 
> gcc-89812.diff
> 
> PR c/89812 - incorrect maximum in error: requested alignment ‘536870912’ 
> exceeds maximum 2147483648
> 
> gcc/c-family/ChangeLog:
> 
>       PR c/89812
>       * c-common.c (check_user_alignment): Rename local.  Correct maximum
>       alignment in diagnostic.  Avoid assuming argument fits in SHWI,
>       convert it to UHWI when it fits.
> 
> gcc/testsuite/ChangeLog:
> 
>       PR c/89812
>       * gcc.dg/attr-aligned-3.c: New test.
OK
jeff

Reply via email to