http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58002
Bug ID: 58002 Summary: [IR tracking] Pointer function results in non pointer context: Shall use a temporary Product: gcc Version: 4.9.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: burnus at gcc dot gnu.org If "fx()" is a pointer returning function, "fx()" is an expression. Hence, for call foo(fx()) the argument should be not the pointer address of fx() but a temporary with the value of the function result. Everything becomes messier with Fortran 2008 as calls to pointer-returning functions count as variables. gfortran currently does not create a temporary in line with Fortran 2008 (!), but it should to conform to Fortran 90/95/2003. See Interpretation Request F08/0089 at http://www.j3-fortran.org/doc/year/13/13-006Ar1.txt - but also at the discussion at http://mailman.j3-fortran.org/pipermail/j3/2013-July/006578.html