From: Marc Glisse <marc.glisse@inria.fr>
To: Jeff Law <law@redhat.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: Warn when returning the address of a temporary (middle-end) v2
Date: Mon, 30 Jun 2014 21:37:00 -0000 [thread overview]
Message-ID: <alpine.DEB.2.10.1406302319090.2048@laptop-mg.saclay.inria.fr> (raw)
In-Reply-To: <53B1D0C5.30901@redhat.com>
On Mon, 30 Jun 2014, Jeff Law wrote:
> On 06/29/14 03:22, Marc Glisse wrote:
>>
>> After looking at PR 61597, I updated the 2 conditions to:
>>
>> + if ((TREE_CODE (valbase) == VAR_DECL
>> + && !is_global_var (valbase))
>> + || TREE_CODE (valbase) == PARM_DECL)
>>
>> a PARM_DECL is a local variable and returning its address is wrong,
>> isn't it?
> Right. It can live in either a caller or callee allocated slot.
The "caller" case scares me a bit. Is it really wrong to return the
address in that case? The slot still exists after returning if the caller
is responsible for it.
> When I first glanced at the patch my thought was "why is this in the path
> isolation pass?"
A very pragmatic reason is that you and Richard asked me to after v1 of
the patch... It doesn't matter that much to me where this goes.
> But I see you want to modify the returned value to be NULL.
> I'll have to look at why you want to do that, but at least I understand why
> it's utilizing the path isolation code.
Originally I mostly wanted to avoid warning several times. Now that the
warning is in a pass that runs only once, it isn't that necessary (it
remains necessary to do something in the front-end to avoid warning again
in the middle-end). It is still an optimization (it probably helps remove
dead code), though I could replace 0 with an undefined variable.
--
Marc Glisse
next prev parent reply other threads:[~2014-06-30 21:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-22 18:20 Marc Glisse
2014-06-29 9:22 ` Marc Glisse
2014-06-30 21:04 ` Jeff Law
2014-06-30 21:37 ` Marc Glisse [this message]
2014-07-02 12:19 ` Alan Modra
2014-07-02 12:41 ` Marc Glisse
2014-07-02 22:39 ` Jeff Law
2014-07-02 22:46 ` Jeff Law
2014-07-18 5:06 ` Jeff Law
2014-07-22 9:04 ` Marc Glisse
2014-07-31 4:54 ` Jeff Law
2014-07-27 18:20 ` Richard Sandiford
2014-07-27 19:09 ` Marc Glisse
2014-07-27 20:45 ` Andreas Schwab
2014-07-27 21:05 ` Marc Glisse
2014-07-29 19:00 ` Marc Glisse
2014-07-29 19:13 ` David Malcolm
2014-07-29 19:22 ` Marek Polacek
2014-07-29 19:47 ` David Malcolm
2014-07-29 19:28 ` Marc Glisse
2014-07-30 12:00 ` Marc Glisse
2014-07-31 4:58 ` Jeff Law
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.DEB.2.10.1406302319090.2048@laptop-mg.saclay.inria.fr \
--to=marc.glisse@inria.fr \
--cc=gcc-patches@gcc.gnu.org \
--cc=law@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).