This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/16198] fegetenv() clears exception mask on x86_64


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]