On Thu, Jun 16, 2016 at 04:32:57AM -0400, Aldy Hernandez wrote:
> p.s. The pass currently warns on all uses of VLAs. I'm not completely sold
> on this idea, so perhaps we could remove it, or gate it with a flag.
Just random nits, no comments on the idea of the patch.
> * walloca.c: New pass.
Wouldn't it be better to call it gimple-ssa-warn-alloca.c or something
similar?
> --- /dev/null
> +++ b/gcc/testsuite/gcc.dg/Walloca-1.c
> @@ -0,0 +1,89 @@
> +/* { dg-do compile } */
> +/* { dg-options "-Walloca -O -Walloca-max-size=2000" } */
> +
> +#define alloca __builtin_alloca
> +
> +typedef unsigned long size_t;
This should be typedef __SIZE_TYPE__ size_t;
> + if (range_type == VR_RANGE
> + && wi::fits_uhwi_p (max)
> + && max.to_uhwi () <= (unsigned) warn_alloca_max_size)
Can't you use just wide-int comparison?
Jakub