On Tue, 2024-07-02 at 22:39 +0200, Mark Wielaard wrote: > Hi David, > > On Tue, Jul 02, 2024 at 03:57:58PM -0400, David Malcolm wrote: > > > > At -O0 sure, that is how __builtin_constant_p works. > > > > The above is intended for optimized compilation, and I think it > > > > works just fine then. > > > > > > And it's generally needed with optimization only, to suppress > > > warnings > > > in unreachable code that only happen when optimization is turned > > > on. > > > > Indeed - and that's why -fanalyzer ran into it at -O0. > > Various -fanalyzer sub-options say something like "optimization > should > be disabled when attempting to trigger this diagnostic". > > Is there an "optimal" optimization level for -fanalyzer (like having > -Og for debugging)?
There isn't, sorry. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111312 for a discussion of this. Dave