#12873: Clear FPU in i386/x86_64 longjmp()
----------------------------------+-----------------------------------------
       Reporter:  jdemeyer        |         Owner:  jdemeyer      
           Type:  defect          |        Status:  closed        
       Priority:  major           |     Milestone:  sage-5.1      
      Component:  c_lib           |    Resolution:  fixed         
       Keywords:                  |   Work issues:                
Report Upstream:  N/A             |     Reviewers:  Volker Braun  
        Authors:  Jeroen Demeyer  |     Merged in:  sage-5.1.beta0
   Dependencies:                  |      Stopgaps:                
----------------------------------+-----------------------------------------

Old description:

> If an interrupt occurs during a 387 FPU computation or during an MMX
> computation (which also uses the FPU registers), then some of the FPU
> registers will be occupied.  This may lead to failures with subsequent
> FPU compuations, see for example #12777.  Some operating systems (e.g.
> Linux and OS X 10.6) restore the FPU state when an interrupt occurs, but
> on Solaris this is not the case.
>
> The proposed solution is to clear the FPU "tag word" (using the `EMMS` or
> `FFREE` instructions) in the signal handler.
>
> To see the problem in action, compile [attachment:emms.c] on i686
> hardware with
> {{{
> gcc -march=pentium2 -m32 -mfpmath=387 -lm emms.c -o emms
> }}}
>
> '''Apply''' [attachment:12873_emms.patch]

New description:

 If an interrupt occurs during a 387 FPU computation or during an MMX
 computation (which also uses the FPU registers), then some of the FPU
 registers will be occupied.  This may lead to failures with subsequent FPU
 compuations, see for example #12777.  Some operating systems (e.g. Linux
 and OS X 10.6) restore the FPU state when an interrupt occurs, but on
 Solaris this is not the case.

 The proposed solution is to clear the FPU "tag word" (using the `EMMS` or
 `FFREE` instructions) in the signal handler.

 To see the problem in action, compile [attachment:emms.c] on i686 hardware
 with
 {{{
 gcc -march=pentium2 -m32 -mfpmath=387 -lm emms.c -o emms
 }}}

 '''Apply''' [attachment:12873_emms.patch]

 '''Obsoleted''' by #13076 and fixed in a better way.

--

Comment (by jdemeyer):

 #13076 fixes this problem in a much better way, so that ticket effectively
 undoes this.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12873#comment:14>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to