PING: new pass to warn on questionable uses of alloca() and VLAs

Jeff Law law@redhat.com
Wed Oct 19 15:55:00 GMT 2016


On 10/19/2016 09:32 AM, Aldy Hernandez wrote:
> On 10/19/2016 09:16 AM, Eric Botcazou wrote:
>>> m68k-suse-linux
>>
>> visium-elf too.
>>
>
> The attached patch fixes the failures on m68k-suse-linux, visium-elf,
> and arm-eabi.
>
> There were a few problems.
>
> One problem is that on lp64 targets (where sizeof(size_t) !=
> sizeof(int)), the warning is slightly different-- and rightly so.  I
> have updated the test to handle both warnings on the respective targets.
>
> The other problem is that the following snippet is incorrectly warning
> on 32-bit targets:
>
>   if (n > 0 && n < 2000)
>     p = __builtin_alloca (n);
>
> Looking at the gimple it seems like another case of VRP failing to give
> any range information whatsoever.  I have xfailed it as another case
> where Andrew's upcoming work should theoretically fix this.  The test is
> fine on 64-bit targets.
>
> Can y'all double check it on your respective targets as I only have a
> crude cross build?
OK for the trunk whenever you're ready.

jeff



More information about the Gcc-patches mailing list