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: [C++] PR19531 NRV is performed on volatile temporary


Christian BRUEL wrote:

>> On mainline, even the previous broken check for volatility seems to be
>> missing.  
> 
> 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?

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713


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