This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/40978] New: Use named return value (NRV) for functions returning the result as argument
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Aug 2009 20:33:05 -0000
- Subject: [Bug fortran/40978] New: Use named return value (NRV) for functions returning the result as argument
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Motivated by PR 40969. See also PR 40976.
For functions where the result is returned by argument, one should use C++'s
named return value optimization (NRV),
cf. http://en.wikipedia.org/wiki/Return_value_optimization
That presumably also allows to mark PURE functions which return their result as
NRV to be marked as PURE.
Caveat: Presumably, using "result, result_" for character strings does not
work with NRV as currently implemented.
See also: CALL_EXPR_RETURN_SLOT_OPT
TODO: Check that the ABI is preserved.
--
Summary: Use named return value (NRV) for functions returning the
result as argument
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: burnus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40978