From: Alejandro Colomar <alx.manpages@gmail.com>
To: Andrew Pinski <pinskia@gmail.com>
Cc: gcc@gcc.gnu.org
Subject: Optimization levels for getting all warnings (was: [BUG] missing warning for pointer arithmetic out of bounds)
Date: Sun, 18 Dec 2022 13:48:16 +0100 [thread overview]
Message-ID: <564aad45-7212-c580-9f7c-66aeeacbb33d@gmail.com> (raw)
In-Reply-To: <CA+=Sn1nhOdZWCy9u_DXuzZZoB5EmhTC5kCwnF4hQ9_6NQiD3XQ@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 896 bytes --]
Hi Andrew
On 12/13/22 20:18, Andrew Pinski wrote:
[...]
>
> GCC only warns during VRP which is only enabled at -O2:
>
> <source>:8:12: warning: array subscript 6 is outside array bounds of
> 'char[5]' [-Warray-bounds=]
> 8 | p = buf + 6;
> | ~~^~~~~~~~~
> <source>:6:19: note: at offset 6 into object 'buf' of size 5
> 6 | char *p, buf[5];
> | ^~~
>
> Thanks,
> Andrew
>
Makes sense. I've seen some warnings that are disabled by optimization, and
others that are enabled by it.
So, if I want to get all warnings that GCC can emit for any given software, is
there a list of optimization levels on which I should compile? Is -O0 and -O3
enough for everything? Or should I also build with all intermediate
optimization levels?
Thanks
Alex
--
<http://www.alejandro-colomar.es/>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-12-18 12:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-13 19:08 [BUG] missing warning for pointer arithmetic out of bounds Alejandro Colomar
2022-12-13 19:15 ` Alejandro Colomar
2022-12-13 19:18 ` Andrew Pinski
2022-12-18 12:48 ` Alejandro Colomar [this message]
2022-12-13 19:22 ` David Malcolm
2022-12-13 19:22 ` Paul Koning
2022-12-13 19:24 ` Alejandro Colomar
2022-12-13 20:45 ` Jonathan Wakely
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=564aad45-7212-c580-9f7c-66aeeacbb33d@gmail.com \
--to=alx.manpages@gmail.com \
--cc=gcc@gcc.gnu.org \
--cc=pinskia@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).