From: Martin Sebor <msebor@gmail.com>
To: Richard Biener <richard.guenther@gmail.com>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] -Walloca-larger-than with constant sizes at -O0 (PR 100425)
Date: Wed, 5 May 2021 11:29:38 -0600 [thread overview]
Message-ID: <83913be9-60c6-ee85-c688-0d106ac36659@gmail.com> (raw)
In-Reply-To: <CAFiYyc25ixCa0mEv5ZwyC-LpR-0Kkx+KJ3MqCR4xna-X6x7pOQ@mail.gmail.com>
On 5/5/21 1:32 AM, Richard Biener wrote:
> 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?
-W{alloca,vla}-larger-than=PTRDIFF_MAX are enabled by default so
the pass needs to do walk.
FWIW, it would make sense to me to consolidate all the checking of
calls for arguments with excessive sizes/values into the same pass
and single walk (with code still in separate source files). As it
is, some are done in their own passes (like alloca and sprintf),
and others during expansion (-Wstringop-overflow), and others in
calls.c (-Walloc-size-larger-than). That leads to repetitive code
and inconsistent approaches and inconsistent false positives and
negatives (because some are done at -O0 but others require
optimization).
Martin
>
> Thanks,
> Richard.
>
>> Martin
next prev parent reply other threads:[~2021-05-05 17:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 1:32 Martin Sebor
2021-05-05 7:32 ` Richard Biener
2021-05-05 17:29 ` Martin Sebor [this message]
2021-05-06 7:02 ` Richard Biener
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83913be9-60c6-ee85-c688-0d106ac36659@gmail.com \
--to=msebor@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).