This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by sdardis on Jan 23 2018, 3:16 AM.

Details

Summary

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

Diff Detail

Repository
rL LLVM

Event Timeline

sdardis created this revision.Jan 23 2018, 3:16 AM
hfinkel accepted this revision.Jan 23 2018, 3:05 PM

LGTM

This revision is now accepted and ready to land.Jan 23 2018, 3:05 PM
MatzeB added a subscriber: MatzeB.Jan 23 2018, 3:39 PM

I guess a more C++y solution would be to #include <cmath> and using std::isnan() instead of using the C headers. But I guess this is fine for now.

sdardis updated this revision to Diff 131458.Jan 25 2018, 8:10 AM

Update as per @MatzeB 's comment, checking before commit showed it broke the build on OSX.

Update as per @MatzeB 's comment, checking before commit showed it broke the build on OSX.

It worked for me like this, but that may be because I have a new clang version installed. This may indeed fail with older versions unless -std=c++11 is passed to the compiler.

Anyway let's leave it as is, if it breaks the build on your side.

Anyway let's leave it as is, if it breaks the build on your side.

Just to double check, the 'it' you're referring to is the build system / compilation options for this test and you're happy with the patch as is?

Anyway let's leave it as is, if it breaks the build on your side.

Just to double check, the 'it' you're referring to is the build system / compilation options for this test and you're happy with the patch as is?

I'm fine with leaving the code in the test-suite as is (no need for this followup patch).

I'm fine with leaving the code in the test-suite as is (no need for this followup patch).

Ah, I think I might have lead you to believe I had committed the previous version of this patch, which just used:

::isnan

to work around the failure with glibc.

Update as per @MatzeB 's comment, checking before commit showed it broke the build on OSX.

Here I should have stated that I checked building the test-suite on OSX before committing the previous version of this patch but when I saw it broke the build with on OSX, I did not commit that version and posted the current version which is against trunk.

My apologies.

MatzeB accepted this revision.Feb 8 2018, 2:58 PM

Just commit whatever version you see fit, I'm fine with any of the proposals; the bots will come back to you and tell you if things don't build somewhere :)

This revision was automatically updated to reflect the committed changes.