https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105346
--- Comment #17 from Richard Biener <rguenth at gcc dot gnu.org> --- A possible fix would be to not run the late checks when not optimizing - in fact the IL for the late and early pass are the same at -O0 so the reason for postponing them isn't there. The only difference is inlining of always-inline functions where one could argue we should do most -O0 diagnostics at that state anyway. Like with the following. Alternatively at -O0 the very first pass instance could do all checking but within a similar construct as the immediately preceeding early -Wuninitialized. diff --git a/gcc/passes.def b/gcc/passes.def index 375d3d62d51..0442b85ee1b 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -402,6 +402,7 @@ along with GCC; see the file COPYING3. If not see number of false positives from it. */ NEXT_PASS (pass_split_crit_edges); NEXT_PASS (pass_late_warn_uninitialized); + NEXT_PASS (pass_warn_access, /*early=*/false); /* uncprop replaces constants by SSA names. This makes analysis harder and thus it should be run last. */ NEXT_PASS (pass_uncprop); @@ -428,7 +429,6 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_gimple_isel); NEXT_PASS (pass_harden_conditional_branches); NEXT_PASS (pass_harden_compares); - NEXT_PASS (pass_warn_access, /*early=*/false); NEXT_PASS (pass_cleanup_cfg_post_optimizing); NEXT_PASS (pass_warn_function_noreturn);