This is the mail archive of the
mailing list for the GCC project.
Re: [C++] PR19531 NRV is performed on volatile temporary
- From: Mark Mitchell <mark at codesourcery dot com>
- To: Christian BRUEL <christian dot bruel at st dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 26 Oct 2007 08:43:33 -0700
- Subject: Re: [C++] PR19531 NRV is performed on volatile temporary
- References: <46FA07E5.firstname.lastname@example.org> <472161D6.email@example.com> <4721C088.firstname.lastname@example.org>
Christian BRUEL wrote:
>> On mainline, even the previous broken check for volatility seems to be
> In the testsuite there is a 'nrv7.C' and a 'nrv9.C' but no 'nrv8.C'. So
> I picked up this slot, but maybe I should have called the test 'nrv15.C'
> instead ?
I'm sorry for being unclear. I wasn't referring to the test number, but
to a line of code in your patch -- which I misread. So, just ignore
what I said. :-)
> Does this bug still exist on mainline and does your change
>> still fix it?
> yes it still exists and my change still fixes it.
Is the check for volatility on both the return type of the function --
TREE_TYPE (TREE_TYPE (fndecl)) -- and on the RESULT_DECL -- TREE_TYPE
(r)) -- necessary?
I would expect that checking the volatility of the function return type
is sufficient; that's the language issue. If, for whatever reason, the
compiler were to make the RESULT_DECL volatile, for a function with a
non-volatile return, I believe that the NRV would still be valid.
Would you please test removing the check on the RESULT_DECL from your patch?
(650) 331-3385 x713