[PATCH] 69780 - [4.9/5/6 Regression] ICE on __builtin_alloca_with_align, with small alignment

Martin Sebor msebor@gmail.com
Wed Feb 24 14:52:00 GMT 2016


On 02/24/2016 07:46 AM, Jakub Jelinek wrote:
> On Wed, Feb 24, 2016 at 07:37:56AM -0700, Martin Sebor wrote:
>> On 02/24/2016 03:12 AM, Dominique d'Humières wrote:
>>> The test gcc.dg/builtins-68.c fails on x86_64-apple-darwin15:
>>
>> Thanks for the heads up.  I see it also fails on i686-pc-linux-gnu
>> and likely other 32-bit targets for similar reasons.  Let me adjust
>> it today.
>
> The last argument is size_t, which is unsigned int on some targets, unsigned
> long on others, unsigned long long on others.
> Thus perpaps you want to turn those
>    p =  __builtin_alloca_with_align (n, LONG_MAX);    /* { dg-error "must be a constant integer" } */
>    p =  __builtin_alloca_with_align (n, ~0LU);        /* { dg-error "must be a constant integer" } */
>    p =  __builtin_alloca_with_align (n, 1LLU << 34);  /* { dg-error "must be a constant integer" } */
>    p =  __builtin_alloca_with_align (n, LLONG_MAX);   /* { dg-error "must be a constant integer" } */
>    p =  __builtin_alloca_with_align (n, ~0LLU);       /* { dg-error "must be a constant integer" } */
> tests into
> ... (n, (size_t) (sizeof (size_t) >= sizeof (long) ? LONG_MAX : 0))
> and similarly for the others?
> I.e. if size_t is big enough, test it, otherwise still generate the error, but for some other reason?

Yes, something like that, thanks.  Some of the tests are redundant
given the builtin's signature and only there out of paranoia. They
can be removed.

Martin



More information about the Gcc-patches mailing list