Hi Rafael,

I overlooked the patch you attached. This is certainly a workaround, but the 
function isnan (in the guise of myisnan) is called by a single example only. 
Like I stated, most compilers support the ieee_is_nan standard function 
nowadays, so I suggest we clean this up more thoroughly.

Regards,

Arjen (slightly distracted by pressing matters, not a good time to answer 
e-mails like this)

-----Original Message-----
From: Rafael Laboissière <raf...@laboissiere.net>
Sent: 30 November 2022 12:40
To: PLplot development list <plplot-devel@lists.sourceforge.net>
Subject: [Plplot-devel] CMake fails to detect NaN for Fortran

Caution: This message was sent from outside of Deltares. Please do not click 
links or open attachments unless you recognize the source of this email and 
know the content is safe. Please report all suspicious emails to 
"servicedesk-...@deltares.nl" as an attachment.


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
DISCLAIMER: This message is intended exclusively for the addressee(s) and may 
contain confidential and privileged information. If you are not the intended 
recipient please notify the sender immediately and destroy this message. 
Unauthorized use, disclosure or copying of this message is strictly prohibited. 
The foundation 'Stichting Deltares', which has its seat at Delft, The 
Netherlands, Commercial Registration Number 41146461, is not liable in any way 
whatsoever for consequences and/or damages resulting from the improper, 
incomplete and untimely dispatch, receipt and/or content of this e-mail.

_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to