Dear PLplot developers,
When building the plplot package for Debian, using the latest version
of gfortran:
$ gfortran --version | head -n1
GNU Fortran (Debian 12.2.0-9) 12.2.0
The CMake configuration fails to detect the NaN capability:
-- Check if isnan function is available in fortran
-- Check for isnan in fortran - not found
I see the following in CMakeFiles/CMakeError.log:
Determining if fortran has isnan function failed with the following output:
Change Dir: [path]/plplot/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp
Run Build Command(s):/usr/bin/gmake -f Makefile cmTC_58c30/fast &&
gmake[2]: Entering directory '[path]/plplot/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp'
/usr/bin/gmake -f CMakeFiles/cmTC_58c30.dir/build.make
CMakeFiles/cmTC_58c30.dir/build
gmake[3]: Entering directory
'[path]/plplot/obj-x86_64-linux-gnu/CMakeFiles/CMakeTmp'
Building Fortran object CMakeFiles/cmTC_58c30.dir/TestFortranIsnan.f.o
/usr/bin/gfortran -g -O2 -ffile-prefix-map=[path]/plplot=.
-fstack-protector-strong -fvisibility=hidden -c
[path]/plplot/cmake/modules/TestFortran
Isnan.f -o CMakeFiles/cmTC_58c30.dir/TestFortranIsnan.f.o
[path]/plplot/cmake/modules/TestFortranIsnan.f:5:19:
5 | if (isnan(0.0/0.0)) then
| 1
Error: Division by zero at (1)
[path]/plplot/cmake/modules/TestFortranIsnan.f:7:9:
7 | endif
| 1
Error: Expecting END PROGRAM statement at (1)
gmake[3]: *** [CMakeFiles/cmTC_58c30.dir/build.make:78:
CMakeFiles/cmTC_58c30.dir/TestFortranIsnan.f.o] Error 1
The patch attached to this message fixes the problem. I think that the
problems arises because the gfortran compiler is trying to do the
computation "0.0/0.0" at compile-time.
Best,
Rafael Laboissière
Description: Avoid FPE during check of NaN for gfortran
Author: Rafael Laboissière <raf...@debian.org>
Forwarded: no
Last-Update: 2022-11-28
--- plplot-5.15.0+dfsg.orig/cmake/modules/TestFortranIsnan.f
+++ plplot-5.15.0+dfsg/cmake/modules/TestFortranIsnan.f
@@ -2,7 +2,8 @@
c external isnan
- if (isnan(0.0/0.0)) then
+ dummy = 0.0
+ if (isnan(0.0/dummy)) then
print *,"NaN"
endif
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel