This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/63446] dangling reference results in confusing diagnostic from -Wuninitialized
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 03 Oct 2014 07:18:29 +0000
- Subject: [Bug tree-optimization/63446] dangling reference results in confusing diagnostic from -Wuninitialized
- Auto-submitted: auto-generated
- References: <bug-63446-4 at http dot gcc dot gnu dot org/bugzilla/>
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.