#4391: forkIO threads do not properly save/restore the floating point 
environment
---------------------------------+------------------------------------------
    Reporter:  draconx           |        Owner:              
        Type:  bug               |       Status:  new         
    Priority:  normal            |    Milestone:  7.2.1       
   Component:  Runtime System    |      Version:  6.12.3      
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  x86_64 (amd64)    |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by rwbarton):

 Replying to [comment:7 draconx]:
 > Replying to [comment:6 rwbarton]:
 > > It would be nice to mention in the documentation, maybe in section
 "12.1.2.
 > > GHC's interpretation of undefined behaviour in Haskell 98" under
 "Unchecked
 > > float arithmetic", that GHC does not manage the floating point
 rounding or
 > > exception registers in any way; in particular, they are not saved or
 restored
 > > by Haskell thread switches, and accessing them directly in conjunction
 with
 > > using built-in floating point operations causes undefined behavior.
 >
 > That would be a very unfortunate limitation as it goes well beyond
 "don't use
 > floating point in unbound threads".

 But that's just the way it is, due to the types of the built-in floating
 point operations not involving IO.  For example, your program produces
 different output ("A: True" on the last line) when compiled with `-O2`,
 due to constant folding.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4391#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to