https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63446
--- Comment #3 from Marc Glisse <glisse at gcc dot gnu.org> --- (In reply to Marc Glisse from comment #2) > make_foo: > > MEM[(struct foo *)&D.2281] = &x; > x ={v} {CLOBBER}; > return D.2281; > > That doesn't seem so easy to warn about. We could walk from return to find > some of the latest non-clobbered dominating writes to that variable, then if > it is an ADDR_EXPR look for dominating clobbers, but that would be very > specialized, Hmm, actually, we can probably ignore the clobber, returning an object that contains a pointer to a local variable is the issue. That's already a bit more doable. Not sure what the best pass would be to add this though. Returning (directly) a pointer to a temporary is handled in isolate-paths IIRC, but that might not be as good a fit for this.