This is the mail archive of the gcc-patches@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]

Re: Warn when returning the address of a temporary (middle-end) v2


On 07/22/14 03:03, Marc Glisse wrote:
I note you don't catch return &localvar in the isolation code -- it
looks like you just catch those which potentially flow from PHIs.

I thought I was handling it in the find_explicit_erroneous_behaviour
part of the patch (as opposed to the implicit part which deals with
PHIs). Function f1 in the testcase addrtmp.c has no PHI. Am I missing
something?
I must have missed that whole block of code. So, no, I don't think you missed anything. My bad. I'm going to choose to blame it on using a laptop screen on the road rather than my usual monitor at home.





I realize you're primarily catching that in the front-ends, but can't
we have cases which aren't caught by the front end, but after
optimizations we're able to propagate &somelocal into the return
statement?

We can, and it was my original motivation. I only added PHI handling
when you asked for it.
Note my comment/question makes no sense now that we've settled that you do have the right code in find_explicit_erroneous_behavior :-)



It generally looks good and I'm ready to approve if the answer to the
above question is "can't happen".  If it can happen, then we ought to
handle it in the isolation code as well (ought to be relatively easy).

Just to be clear, the approval would include the PARM_DECL tweak in
https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02327.html
Yes.

jeff


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