https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94189
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 48039 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48039&action=edit gcc10-pr94189-2.patch Another possible fix. Don't optimize if we would emit a warning and don't emit it just because the warning isn't enabled, -w or some other warning has been emitted for the call already. I think this is my preference.