https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91388
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |pinskia at gcc dot gnu.org Status|NEW |ASSIGNED --- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- So I think the fix is to gate pass_warn_function_return on error_count. Because we don't know 100% the state of the IR coming in. As errors are already removed by the time we get there and that means things like an error on static_assert or and error on COMPOUND_EXPR (like in PR 119149), there are no markers. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60440#c9 definitely makes it sound like it is the same issue too. Which makes me thing we should not warn if there has been an error already.