This is the mail archive of the
mailing list for the GCC project.
Re: Warn when returning the address of a temporary (middle-end) v2
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: Marc Glisse <marc dot glisse at inria dot fr>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sun, 27 Jul 2014 19:15:22 +0100
- Subject: Re: Warn when returning the address of a temporary (middle-end) v2
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 2 dot 02 dot 1406221930380 dot 20514 at stedding dot saclay dot inria dot fr>
Marc Glisse <email@example.com> writes:
> I followed the advice in this discussion:
> and here is a new patch. I made an effort to isolate a path in at least
> one subcase so it doesn't look too strange that the warning is in this
> file. Computing the dominance info just to tweak the warning message may
> be a bit excessive.
How about only calculating it once you've decided to issue a message?
> + if (always_executed)
> + msg = "function returns address of local variable";
> + else
> + msg = "function may return address of local variable";
I think you need _(...) here, unless some magic makes that unnecessary now.