Re: -Wstack-usage and alloca in loops

2014-09-22 Thread Eric Botcazou
> The implementation of -Wstack-usage is a bit lame in that it does not do > any flow analysis or tie into the range information computed by VRP. Right, that was by design in order to be conservatively correct. May I remind you of where we came from with -Wframe-larger-than? :-) > Moving the st

Re: -Wstack-usage and alloca in loops

2014-09-22 Thread Jeff Law
On 09/22/14 09:56, Dmitry Antipov wrote: For the following translation unit: #include int foo (unsigned n) { int *p; if (n < 1024) p = alloca (n * sizeof (int)); else p = malloc (n * sizeof (int)); return g (p, n); } int bar (unsigned n) { int x, i, *p; for (x =

-Wstack-usage and alloca in loops

2014-09-22 Thread Dmitry Antipov
For the following translation unit: #include int foo (unsigned n) { int *p; if (n < 1024) p = alloca (n * sizeof (int)); else p = malloc (n * sizeof (int)); return g (p, n); } int bar (unsigned n) { int x, i, *p; for (x = 0, i = 0; i < n; i++) { if (n < 1024)