https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90710
--- Comment #2 from sagebar at web dot de --- (In reply to Jeffrey A. Law from comment #1) > We focus most of our effort on avoiding false positives with -O2 > optimization levels. As you lower the optimization level (-Og) you will > almost certainly run into these kinds of issues. > > Elimination of false positive uninitialized warnings is highly dependent > upon what we call "jump threading". The purpose of jump threading is to > realize that certain paths through the CFG are not possible and to use block > copying to isolate and remove those paths. At lower optimization levels the > compiler does not aggressively thread jumps and thus can leave unexecutable > paths in the CFG which leads to the false positive warning. > > The use of builtin_expect can have these effects too as it impacts the cost > analysis done during jump threading to determine the cost/benefit of block > copying to isolate the path. > > > So confirmed, but not likely something we'll fix in the near future. Thanks for taking the time to explain the what-s and why-s. Dealing with a long-time -O3-compiled codebase (always having optimizations at max prevents nasty surprises later), I was originally trying to use -Og to improve the quality of .debug_info for gdb (I read somewhere that that -Og's supposed to be used for), but for anyone else that has the same Problem and finds this, I managed to get it to work well enough by simply not passing any -O* flags for the time being.