-
-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong return type for std::isinf/isnan(double) #108
Comments
It's easy to confirm in godbolt that this should work as claimed in the OP. The first suspicion I have is that this is somehow due to the underlying glibc, because |
@h-vetinari thank you! Is there any way now to check if glib is the problem for the current issue? |
You can add a compilation test to the recipe here, plus
under |
I did some investigation with current build and that's what I've found: from #ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
constexpr bool
isnan(float __x)
{ return __builtin_isnan(__x); }
#if _GLIBCXX_HAVE_OBSOLETE_ISNAN \
&& !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
using ::isnan;
#else
constexpr bool
isnan(double __x)
{ return __builtin_isnan(__x); }
#endif
constexpr bool
isnan(long double __x)
{ return __builtin_isnan(__x); }
#endif Then I've created test file: #include <cmath>
#include <cstdio>
int main(){
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
printf("define float\n");
#if _GLIBCXX_HAVE_OBSOLETE_ISNAN \
&& !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
printf("not define double\n");
#else
printf("define double\n");
#endif
printf("define long double\n");
#endif
#if _GLIBCXX_HAVE_OBSOLETE_ISNAN
printf("_GLIBCXX_HAVE_OBSOLETE_ISNAN\n");
#endif
#if _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
printf("_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC\n");
#endif
return 0;
} compile + run:
So, for some reason @h-vetinari do you know why is it happening? |
P.S.: output for the system
|
So it's not super-obvious how
I also found the following commit: gcc-mirror/gcc@350fe28, which means that Given that your |
I can reproduce the same issue on Ubuntu 22.04 with gcc 11.4.0. So this is not unique to conda. Probably a gcc bug. |
How did you reproduce it exactly? According to godbolt, it works back all the way to GCC + libstdcxx v7 |
Ubuntu 22.04 with stock gcc 11.4.0 |
Or both ubuntu and conda-forge have the same kind of packaging bug... |
What's the output of the test script above? What are the values of |
test.cpp: #include <cmath>
#include <cstdio>
#include <gnu/libc-version.h>
int main(){
printf("GNU libc version: %s\n", gnu_get_libc_version());
printf("GNU libc release: %s\n", gnu_get_libc_release());
#ifndef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP
printf("define float\n");
#if _GLIBCXX_HAVE_OBSOLETE_ISNAN \
&& !_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
printf("not define double\n");
#else
printf("define double\n");
#endif
printf("define long double\n");
#endif
#if _GLIBCXX_HAVE_OBSOLETE_ISNAN
printf("_GLIBCXX_HAVE_OBSOLETE_ISNAN\n");
#endif
#if _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
printf("_GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC\n");
#endif
#ifdef _GLIBCXX_HAVE_OBSOLETE_ISNAN
printf("def _GLIBCXX_HAVE_OBSOLETE_ISNAN\n");
#endif
#ifdef _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC
printf("def _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC\n");
#endif
return 0;
} Ubuntu 22.04 output:
Conda output:
|
Thanks! So the macro is defined but false. I'm absolutely mystified how
can evaluate to false on your system.
Can you provide a few more details on how you ran this? @isuruf said he can reproduce the problem on 22.04 with stock GCC, yet your 22.04 looks fine? |
@h-vetinari it is actually strange, because I've just tried stock ubuntu in docker container:
|
And 20.04 works as well (
Ubuntu 18.04 (
Ubuntu 16.04 (
Ubuntu 14.04 (
|
Can you add
In godbolt this gets me
|
@h-vetinari sorry for long response, here is the output of conda:
And ubuntu output:
See the difference |
From sources:
That means, that So, having that, even upgrade to glibc |
Having that
Both those files are maintained by libstdcxx-devel. My bet, is if conda is restricted to |
|
Wait, this is probably coming in due to the presence of
Can you try installing If I do that, I get the following output with our compilers:
|
@h-vetinari yes! Sorry, I've looked at
And indeed:
sysroot is overriding it. Do you know how to use real glibc version? |
Pointing to our own Since this is a runtime dependence here in the recipe
you also cannot override this with the currently-published artefacts (and we can't remove it here because it's required to keep our infrastructure working). Possible answers (we'll definitely need input from @conda-forge/linux-sysroot here):
|
Solution to issue cannot be found in the documentation.
Issue
Return type of
std::isinf(double);
must bebool
, notint
. Similar issue happens with pkgs/main.Was able to reproduce both with clang++ and g++.
cpp reference (https://en.cppreference.com/w/cpp/numeric/math/isinf):
To create environment:
Exact error:
Installed packages
Environment info
The text was updated successfully, but these errors were encountered: