[GHC] #9407: Program produces different output when compiled with -O

GHC ghc-devs at haskell.org
Tue Aug 5 03:25:38 UTC 2014


#9407: Program produces different output when compiled with -O
-------------------------------------+-------------------------------------
       Reporter:  arotenberg         |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.8.3
       Keywords:                     |        Operating System:  Windows
   Architecture:  x86_64 (amd64)     |         Type of failure:  Incorrect
     Difficulty:  Unknown            |  result at runtime
     Blocked By:                     |               Test Case:
Related Tickets:                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 When compiled and run as
 {{{
 ghc Subtlety.hs
 Subtlety
 }}}
 the attached program generates the correct output of
 {{{
 Just (Vec3 0.0 0.0 1.0)
 }}}
 but when compiled and run using
 {{{
 ghc -O Subtlety.hs
 Subtlety
 }}}
 the program's output is
 {{{
 Just (Vec3 0.0 0.9805806756909202 0.19611613513818404)
 }}}
 Furthermore, subtle changes to the source code (like removing the
 strictness on the `Vec3` type's fields) can alter the behavior of the
 compiled program.

 I am using GHC 7.8.3 x86-64 from Haskell Platform 2014.2.0.0 RC2 on
 Windows 8.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9407>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list