[Bug c/83172] -Wstack-size= doesn't detect the correct stack size with VLA or alloca
hao.hou at utah dot edu
gcc-bugzilla@gcc.gnu.org
Mon Nov 27 17:42:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83172
--- Comment #2 from Hao Hou <hao.hou at utah dot edu> ---
(In reply to Eric Botcazou from comment #1)
> What happens for -Wvla-larger-than= if you use -O0 or -O1 instead of -O3?
The same result:
$ gcc-7 -Wvla-larger-than=128 -Wstack-usage=102400 -O0 -c t.c
t.c: In function ‘stack_usage_only’:
t.c:23:5: warning: stack usage might be unbounded [-Wstack-usage=]
int stack_usage_only(unsigned x)
^~~~~~~~~~~~~~~~
t.c: In function ‘alloca_fails_even_with_const’:
t.c:32:5: warning: stack usage might be unbounded [-Wstack-usage=]
int alloca_fails_even_with_const()
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
-O1 results the same.
More information about the Gcc-bugs
mailing list