Cactus offers functions "CCTK_isnan" etc. that always do what the name suggests, so that compilers can optimize "isnan" away if they want.
-erik
---------- Forwarded message ---------- From: Bitbucket commits-noreply@bitbucket.org Date: Wed, Dec 7, 2016 at 5:05 PM Subject: commit/SimFactory2: rhaas80: Ubuntu: disable finite-math-only To: commits@cactuscode.org
1 new commit in SimFactory2:
https://bitbucket.org/simfactory/simfactory2/commits/cb947f7282c4/ Changeset: cb947f7282c4 Branch: master User: rhaas80 Date: 2016-12-06 19:37:49+00:00 Summary: Ubuntu: disable finite-math-only
this turns isnan() into a no-op
Affected #: 1 file
Repository URL: https://bitbucket.org/simfactory/simfactory2/
--
This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. _______________________________________________ Commits mailing list Commits@cactuscode.org http://cactuscode.org/mailman/listinfo/commits
Hello Erik,
Cactus offers functions "CCTK_isnan" etc. that always do what the name suggests, so that compilers can optimize "isnan" away if they want.
Are you sure about this? I have (in src/util/Math.c):
--8<-- int CCTK_isnan(double x) { #ifdef HAVE_ISNAN return isnan(x); #else return 0; /* default */ #endif } --8<-- and -ffinite-math-only turns isnan into a no-op that always returns "true".
HAVE_ISNAN is set by the configure script. NaNChecker uses CCTK_isnan yet it failed on machines using unbuntu.cfg which uses -ffast-math (which includes -ffinite-math-only).
Yours, Roland
On Wed, Dec 7, 2016 at 5:36 PM, Roland Haas rhaas@illinois.edu wrote:
Hello Erik,
Cactus offers functions "CCTK_isnan" etc. that always do what the name suggests, so that compilers can optimize "isnan" away if they want.
Are you sure about this? I have (in src/util/Math.c):
--8<-- int CCTK_isnan(double x) { #ifdef HAVE_ISNAN return isnan(x); #else return 0; /* default */ #endif } --8<-- and -ffinite-math-only turns isnan into a no-op that always returns "true".
HAVE_ISNAN is set by the configure script. NaNChecker uses CCTK_isnan yet it failed on machines using unbuntu.cfg which uses -ffast-math (which includes -ffinite-math-only).
When I checked, only C++ compilers replaced "isnan", not C compilers, thus redirecting C++ calls to this C function worked fine. If this doesn't work any more then we'll have to be more clever and examine the bit pattern. (We can do this even in a header file, we then don't need the C implementation file any more.)
-erik
users@lists.einsteintoolkit.org