This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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]

Strange warning about unused function


With the attached test case I get the following warning:

$ gfortran -Wall test_unused_func.f90 -o test_unused_func.out
test_unused_func.f90:54:0: warning: 'f' defined but not used [-Wunused-function]
   real(dp) function f(x) result(y)
 ^

which I find a bit "strange": after all, the function f() is used because it is passed to the call of simpson().. and indeed

$ ./test_unused_func.out
   1.4250604553524227
   1.9202581413298656

confirming it is _used_!

I used gfortran from GCC: 4.8.2 (MSYS2 64), 4.8.3 (OSX+MacPorts 64, Cygwin64), 4.9.1 (MSYS2+MinGW64)

Surely, I am missing something so I flag this for the sake of completeness.


Ciao,
 Angelo.

Attachment: test_unused_func.f90
Description: Text document


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