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: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to