This is the mail archive of the gcc-bugs@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]

[Bug fortran/40978] New: Use named return value (NRV) for functions returning the result as argument


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


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