[test-suite] r325231 - [test-suite] Fix ambigous call to overloaded function isnan

Simon Dardis via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 03:38:39 PST 2018


Author: sdardis
Date: Thu Feb 15 03:38:39 2018
New Revision: 325231

URL: http://llvm.org/viewvc/llvm-project?rev=325231&view=rev
Log:
[test-suite] Fix ambigous call to overloaded function isnan

Reviewers: hfinkel, MatzeB

Older versions of glibc expose isnan as C99 macros and C++ functions, causing
a compilation failure of the CLAMR benchmark. Address this by explicitly calling
the c++ version of this function.

For reference: https://sourceware.org/bugzilla/show_bug.cgi?id=19439,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48891

Differential Revision: https://reviews.llvm.org/D42411

Modified:
    test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/CLAMR/clamr_cpuonly.cpp

Modified: test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/CLAMR/clamr_cpuonly.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C%2B%2B/CLAMR/clamr_cpuonly.cpp?rev=325231&r1=325230&r2=325231&view=diff
==============================================================================
--- test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/CLAMR/clamr_cpuonly.cpp (original)
+++ test-suite/trunk/MultiSource/Benchmarks/DOE-ProxyApps-C++/CLAMR/clamr_cpuonly.cpp Thu Feb 15 03:38:39 2018
@@ -55,7 +55,7 @@
  */
 
 #include <algorithm>
-#include <math.h>
+#include <cmath>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/time.h>
@@ -499,7 +499,7 @@ extern "C" void do_calc(void)
 
    int error_status = STATUS_OK;
 
-   if (isnan(H_sum)) {
+   if (std::isnan(H_sum)) {
       printf("Got a NAN on cycle %d\n",ncycle);
       error_status = STATUS_NAN;
    }




More information about the llvm-commits mailing list