[GHC] #3207: readMutVar# is inlined/duplicated

GHC trac at galois.com
Wed May 6 08:38:03 EDT 2009


#3207: readMutVar# is inlined/duplicated
---------------------------------+------------------------------------------
    Reporter:  simonmar          |        Owner:                  
        Type:  bug               |       Status:  new             
    Priority:  normal            |    Milestone:  6.12.1          
   Component:  Compiler          |      Version:  6.10.2          
    Severity:  normal            |   Resolution:                  
    Keywords:                    |   Difficulty:  Unknown         
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Comment (by daniel.is.fischer):

 Confirmed, if compiled without optimisations:
 {{{
 dafis at linux-mkk1:~/Haskell/CafeTesting> ghc --make simonMar
 [1 of 1] Compiling Main             ( simonMar.hs, simonMar.o )
 Linking simonMar ...
 dafis at linux-mkk1:~/Haskell/CafeTesting> ./simonMar
 v: 0
 v: 0
 ()
 }}}
 However, with optimisations:
 {{{
 dafis at linux-mkk1:~/Haskell/CafeTesting> touch simonMar.hs
 dafis at linux-mkk1:~/Haskell/CafeTesting> ghc -O2 --make simonMar
 [1 of 1] Compiling Main             ( simonMar.hs, simonMar.o )
 Linking simonMar ...
 dafis at linux-mkk1:~/Haskell/CafeTesting> ./simonMar
 v: 0
 v: 1
 simonMar: MArray: undefined array element
 }}}
 Strangely, the code from haskell-cafe, when I include an explicit export
 list (main), behaves differently:
 {{{
 dafis at linux-mkk1:~/Haskell/CafeTesting> ghc --make tobOlau
 [1 of 1] Compiling Main             ( tobOlau.hs, tobOlau.o )
 Linking tobOlau ...
 dafis at linux-mkk1:~/Haskell/CafeTesting> ./tobOlau
 tobOlau: should never match this
 dafis at linux-mkk1:~/Haskell/CafeTesting> touch tobOlau.hs
 dafis at linux-mkk1:~/Haskell/CafeTesting> ghc -O --make tobOlau
 [1 of 1] Compiling Main             ( tobOlau.hs, tobOlau.o )
 Linking tobOlau ...
 dafis at linux-mkk1:~/Haskell/CafeTesting> ./tobOlau
 101
 dafis at linux-mkk1:~/Haskell/CafeTesting> ghc --version
 The Glorious Glasgow Haskell Compilation System, version 6.10.1
 dafis at linux-mkk1:~/Haskell/CafeTesting> uname -a
 Linux linux-mkk1 2.6.27.21-0.1-pae #1 SMP 2009-03-31 14:50:44 +0200 i686
 i686 i386 GNU/Linux
 }}}
 while without export list, behaviour is independent of optimisation level.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3207#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list