On Wed, May 5, 2021 at 4:20 AM Martin Sebor via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Even when explicitly enabled, -Walloca-larger-than doesn't run > unless optimization is enabled as well. This prevents diagnosing > alloca calls with constant arguments in excess of the limit that > could otherwise be flagged even at -O0, making the warning less > consistent and less useful than is possible. > > The attached patch enables -Walloca-larger-than for calls with > constant arguments in excess of the limit even at -O0 (variable > arguments are only handled with optimization, when VRP runs).
Hmm, but then the pass runs even without -Walloca or -Walloca-larger-than or -Wvla[-larger-than]. It performs an IL walk we should avoid in those cases. So the patch is OK but can you please come up with a gate that disables the pass when all of the warnings it handles won't fire anyway? Thanks, Richard. > Martin