https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121093
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- we don't elide inlined_function_outer_scope_p IIRC, so not sure why this would happen? But the flow of conditions is a bit odd: /* When not generating debug info we can eliminate info on unused variables. */ else if (!flag_auto_profile && debug_info_level == DINFO_LEVEL_NONE && !optinfo_wants_inlining_info_p ()) { /* Even for -g0 don't prune outer scopes from inlined functions, otherwise late diagnostics from such functions will not be emitted or suppressed properly. */ if (inlined_function_outer_scope_p (scope)) { gcc_assert (TREE_CODE (BLOCK_ORIGIN (scope)) == FUNCTION_DECL); unused = false; } } else if (BLOCK_VARS (scope) || BLOCK_NUM_NONLOCALIZED_VARS (scope)) unused = false; /* See if this block is important for representation of inlined function. Inlined functions are always represented by block with block_ultimate_origin being set to FUNCTION_DECL and DECL_SOURCE_LOCATION set, unless they expand to nothing... */ else if (inlined_function_outer_scope_p (scope)) unused = false;