On 03/02/2017 05:32 AM, Marek Polacek wrote:
As demonstrated by this test, we can crash on the assert in alloca_call_type:
gcc_assert (is_vla || warn_alloca_limit > 0);
when -Walloca-larger-than= receives an argument greater than INT_MAX. Even
though warn_vla_limit is marked as UInteger in c.opt, those are still
represented as ints; opt-functions.awk has
202 else if (flag_set_p("UInteger", flags))
203 return "int "
...
213 if (flag_set_p("UInteger", flags))
214 return "int "
So 4207115063 is converted to int which is some negative value.
It's probably too late to change opt-functions.awk now, so the following
is a badn aid fix.
Bootstrapped/regtested on x86_64-linux, ok for trunk?
2017-03-02 Marek Polacek <pola...@redhat.com>
PR middle-end/79809
* gimple-ssa-warn-alloca.c (pass_walloca::gate): Use HOST_WIDE_INT.
(alloca_call_type): Likewise.
* g++.dg/Walloca1.C: New test.
OK.
jeff