https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77905
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 40309 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40309&action=edit gcc7-pr77905.patch Untested fix. The problem is that during local pure/const pass, it is determined to be const, but looping, so DECL_STATIC_CONSTRUCTOR is not removed from it. Only during the ipa pure/const pass it is determined not looping, which removes DECL_STATIC_CONSTRUCTOR, but has_cdtor is not set because it is already const (but looping), so we don't do TODO_remove_functions.