-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Test overload_numeric failed against GCC 6 #615
Comments
|
which version of Python? |
|
Works for me on Debian unstable x86-64 with: I wonder if it's an optimisation issue - @jplesnik: can you try: Python says we should use these flags: A newer GCC version might well optimise more based on alias analysis or integer overflow analysis. We should probably be asking python what flags to compile the C/C++ code with in configure. |
|
Version of Python version is The version of GCC is @ojwb: I tried the command, but it failed |
|
I noticed there was a newer GCC 6 snapshot available in Debian experimental than the one I already had installed - with the newer version I get the error. So this seems to be related to some change between these versions: Looking at the generated code, the issue seems to be that the I think the root cause is that |
|
As we are including math.h instead of cmath, I think g++ should have this as a macro, but as it isn't, you'd better put in your proposed change. |
|
Hmm, that failed in travis (but was OK for me). If I decode the error correctly, I think we need to use |
|
Hmm, I noted this as a fix for Python in |
|
Yes indeed. |
|
@ojwb, could you correct the CHANGES file? We can then close this issue. |
|
I'm not really sure what to put instead, so I just deleted Anyway, feel free to improve. |
|
That's what I do too if it affects many languages. |
|
The original fix was good, but the follow-up commit is incorrect and causes failures like the one below with Clang 3.8 as compiler. Since the header include is math.h, isfinite is not in the std namespace. You must include cmath if you are going to use std::isfinite. I had to revert 75510a1 locally to correct this problem. For full context, see https://www.mail-archive.com/freebsd-pkg-fallout@freebsd.org/msg313198.html https://www.mail-archive.com/freebsd-pkg-fallout@freebsd.org/msg311258.html https://www.mail-archive.com/freebsd-pkg-fallout@freebsd.org/msg311264.html |
|
The follow-up commit was needed for the GCC6 snapshot package that was in Debian experimental, though it doesn't seem to be needed for the 6.1.1 package now in Debian unstable.
The issue was that at least for some versions of GCC, |
Definitely. I won't call it `better off', it's actually the only correct way of getting access to std::isfinite(). |
|
That's "better off than reverting the second commit"... The patch in #788 results in |
|
This may be silly idea as I know nothing on what's going on with this code, but why do you need |
|
It needs to work as C code too, and C doesn't have |
|
isfinite is a C99 and C11 macro in math.h:
C++11 states (17.6.1.2 Headers):
and D.5:
I read this as This does need fixing asap for the next release. |
|
There is more explicitly about cmath, from the C++11 standard:
So with this info, it is becomes murky. The way to interpret this is cmath defines 3 overloaded versions of So whether or not it is a function or macro is not clear and implemented differently, but we must conclude that Whether or not it should be in the std namespace is unclear and my experiments show that sometimes it is not. |
Indeed. Sorry, I've been failing to find the time to sit down and sort it out properly, and I'd much prefer to address this once such that it works for anything standard conforming plus anything in common use which isn't quite conforming, and that's going to need some care with implementation and especially testing (or else there's a real risk we fix this for some cases but break it for others which currently work). |
|
OK, I've reviewed all this and attempted a fix (see #849). CI will give it some testing, but please test more widely. This ought to work whether The alternative approach I can see is to change the |
I tried to rebuild swig 3.0.8 against GCC 6, but the python testcase overload_numeric failed. I got following error:
GCC 6 is part of the Fedora Rawhide.
The test passed with GCC 5.3.1.
The text was updated successfully, but these errors were encountered: