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
Stop using deprecated floating-point environment functions on FreeBSD #68708
Comments
The attached patch moves to use the fenv functions on FreeBSD to control the floating-point environment. This will be needed as I don't expect FreeBSD will have these functions on arm64. I would expect a similar change should be applied to any supported development branch. |
It looks like fpsetmask() was deprecated since many years, and that fedisableexcept() is available since FreeBSD 5.3. Since we try to support FreeBSD 9, it's fine to drop support of FreeBSD < 5.3. I'm concerned by the "CAVEATS" section below. Should we put "#pragma STDC FENV_ACCESS ON" in all .c file using a C double? @skrah: I saw this pragma in Modules/_decimal/libmpdec/mpdecimal.c. Any idea if applying this patch is fine? Maybe we can start by applying it to the default branch? If this patch is required to support arm64, I think that it's ok to apply it to 2.7, 3.4 and 3.5 since we still accept changes to fix platform compatibility issues. http://www.unix.com/man-page/freebsd/3/fpsetmask/ http://www.unix.com/man-page/freebsd/3/fenv/ CAVEATS |
In theory we should set FENV_ACCESS whenever the control word is "If part of a program tests floating-point status flags, sets In practice gcc ignores the pragma, icc and cl.exe use it, not |
FYI in Python/pytime.c, I put a lot of "volatile double" when tests started to fail on some platforms. It's inefficient, but it's easier than teaching how to disable optimizations on each different compiler :-p |
Ok, clang does not support it either: |
Regarding volatile: gcc/clang seem to honor *some* changes to Let's rewrite Python in asm to avoid these issues. :) |
Sorry, I don't understand if we should apply or not the patch :-/ |
Can this be applied? |
This issue is becoming increasingly important as FreeBSD 11.0-RELEASE time nears. What remains to be done/identified/answers here to make progress? |
Andrew Turner: "Can this be applied?" koobs: "What remains to be done/identified/answers here to make progress?" *I* don't understand if replacing fpsetmask() with fedisableexcept() is enough, or if we also need to starting putting "#pragma STDC FENV_ACCESS ON" in all .c file using a C double? It's not a rhetorical question, I don't understand the consequence of the attached patch. If two FreeBSD developers (Andrew Turner and koobs) are confident, maybe I should trust them and apply blindly the patch without trying to understand it :-D |
|
I think this patch is correct. Clang, as shipped by FreeBSD, doesn't support FENV_ACCESS. It raises the following warning: fenv_test.c:2:14: warning: pragma STDC FENV_ACCESS ON is not supported, ignoring pragma [-Wunknown-pragmas] I expect the man page mentions it because it is mentioned in the standard. In the bugs section it does say the pragma is unimplemented. |
Thanks, then the patch looks good to me. |
New changeset 76f35f35be50 by Victor Stinner in branch '3.5': New changeset 6134d9ecab60 by Victor Stinner in branch 'default': New changeset 394ae9efc5c2 by Victor Stinner in branch '2.7': |
"I expect the man page mentions it because it is mentioned in the standard. In the bugs section it does say the pragma is unimplemented." Ah ah, funnny. Sorry, I was confused by the manual page. I pushed your patch to Python 2.7, 3.5 and default (3.6) branches. @koobs: sorry, 3.4 now only accept security fixes :-p |
I wrote a table giving the status of each Python branch to know which ones still accept bugfixes or not: |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: