https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78886
--- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> --- (In reply to Marc Glisse from comment #8) > (In reply to Jakub Jelinek from comment #5) > > I'd say tree-ssa-strlen.c is not the pass that should remove the malloc. > > We probably want another PR about this, because a malloc whose return value > is ignored should not have survived all the way to the strlen pass. > gimple_fold_builtin looks like a place where we could handle this. I don't > know if there is some attribute that could be put on malloc so that DCE > would handle it automatically... Yep, I've just created PR78902.