http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51512
Bug #: 51512
Summary: RFC: Bogus "Return value of function"/"INTENT(OUT) was
not set" with allocatable results/dummies
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
gfortran -Wall prints for the following program:
Warning: Return value of function 'f' at (1) not set
However, as "f" is allocatable, the program is valid and the function result is
an unallocated array.
RFC: Should we really print a warning? The program is valid, though most of the
time this indicates a programming error.
In GCC 4.3, gfortran did not warn; 4.4 to 4.7 do.
function f()
integer, allocatable :: f(:)
end function f
Related:
integer function f(x)
integer, allocatable, intent(out) :: x(:)
f = 5
end function f
Again, gcc 4.5 (!) to 4.7 print a warning:
Warning: Dummy argument 'x' at (1) was declared INTENT(OUT) but was not set
But again, the code is questionable but perfectly standard conform and in some
cases even useful.