This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug math/16198] fegetenv() clears exception mask on x86_64
- From: "joseph at codesourcery dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Thu, 21 Nov 2013 00:23:25 +0000
- Subject: [Bug math/16198] fegetenv() clears exception mask on x86_64
- Auto-submitted: auto-generated
- References: <bug-16198-131 at http dot sourceware dot org/bugzilla/>
http://sourceware.org/bugzilla/show_bug.cgi?id=16198
--- Comment #3 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
On Wed, 20 Nov 2013, fxcoudert at gcc dot gnu.org wrote:
> I have found code that uses fldcw, right after fnstenv:
>
> __asm__ __volatile__ ("fnstenv\t%0" : "=m" (*envp));
>
> /* fnstenv has the side effect of masking all exceptions, so we need
> to restore the control word after that. */
> __asm__ __volatile__ ("fldcw\t%0" : : "m" (envp->__control_word));
I don't see that anywhere in glibc.
> (I've tried to understand why there are so many occurrences of fegetenv, either
> in function or macro forms, in x86/i?86/x86_64-specific files in libc, but I
> failed utterly. Thanks for having a look at this.)
Various optimized versions of environment functions are for use by libm
functions that only need to change one of the x87 and SSE environments,
not both, or that can optimize by storing and restoring only relevant bits
of environment in local variables without needing the full user semantics
of the public <fenv.h> functions.
--
You are receiving this mail because:
You are on the CC list for the bug.