Re: how does -Wstringop-truncation work?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 30, 2023 at 05:35:39PM -0500, Patrick Herbst via Gcc-help wrote:
> I can get the warning to display if running
> gcc -Wall -02
> 
> I can even get it to display if running
> gcc -Wall -O1 -foptimize-strlen
> 
> but i cannot get it to display if not using optimization.

The manual says
  The effectiveness of some warnings depends on optimizations also being
  enabled.  For example '-Wsuggest-final-types' is more effective with
  link-time optimization and some instances of other warnings may not be
  issued at all unless optimization is enabled.  While optimization in
  general improves the efficacy of control and data flow sensitive
  warnings, in some cases it may also cause false positives.

> I've even
> tried manually adding all the -f options documented for -O1 to
> understand what other flags might be needed to generate the warning.

Flags like -O1 do more than just enabling some other flags.


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux