This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/63446] dangling reference results in confusing diagnostic from -Wuninitialized


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]