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

2012-01-12 Thread GHC
#3207: readMutVar# is inlined/duplicated
--+-
  Reporter:  simonmar |  Owner:  igloo   
  Type:  merge| Status:  closed  
  Priority:  normal   |  Milestone:  6.10 branch 
 Component:  Compiler |Version:  6.10.2  
Resolution:  fixed|   Keywords:  
Os:  Unknown/Multiple |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown | Difficulty:  Unknown 
  Testcase:  codeGen/should_run/3207  |  Blockedby:  
  Blocking:   |Related:  
--+-
Changes (by simonpj):

  * testcase:  => codeGen/should_run/3207
  * failure:  => None/Unknown


-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler

___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


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

2009-05-22 Thread GHC
#3207: readMutVar# is inlined/duplicated
-+--
Reporter:  simonmar  |Owner:  igloo   
Type:  merge |   Status:  closed  
Priority:  normal|Milestone:  6.10 branch 
   Component:  Compiler  |  Version:  6.10.2  
Severity:  normal|   Resolution:  fixed   
Keywords:|   Difficulty:  Unknown 
Testcase:|   Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
-+--
Changes (by igloo):

  * status:  new => closed
  * resolution:  => fixed

Comment:

 Merged.

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


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

2009-05-18 Thread GHC
#3207: readMutVar# is inlined/duplicated
-+--
Reporter:  simonmar  |Owner:  igloo   
Type:  merge |   Status:  new 
Priority:  normal|Milestone:  6.10 branch 
   Component:  Compiler  |  Version:  6.10.2  
Severity:  normal|   Resolution:  
Keywords:|   Difficulty:  Unknown 
Testcase:|   Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
-+--
Changes (by simonmar):

  * owner:  simonmar => igloo
  * type:  bug => merge
  * milestone:  6.12.1 => 6.10 branch

Comment:

 Fixed:

 {{{
 Fri May 15 15:36:08 BST 2009  Simon Marlow 
   * Fix #3207: add has_side_effects = True for lots of primops
   and document primOpHasSideEffects
 }}}

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


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

2009-05-15 Thread GHC
#3207: readMutVar# is inlined/duplicated
-+--
Reporter:  simonmar  |Owner:  simonmar
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  |  
-+--
Changes (by simonmar):

  * owner:  => simonmar

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


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

2009-05-08 Thread GHC
#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 j.waldmann):

 I will attach a file (STCheck) that is perhaps related.

 Behaviour is: when using ghc-6.10.2 and STRef.Lazy, it enters a <>
 (in ghci, it just hangs, prompt never returns).
 When compiled with ghc-6.8.3, it prints the expected answer (1).

 With ghc-6.10.2 and STRef.Strict, it works.

 With ghc-6.10.2 and replacing readSTRef/writeSTRef (end of program)
 by modifySTRef, it works as well.

 (This actually cost me several hours to isolate.
 The "cache" function is from a real program.)

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


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

2009-05-06 Thread GHC
#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:
 {{{
 da...@linux-mkk1:~/Haskell/CafeTesting> ghc --make simonMar
 [1 of 1] Compiling Main ( simonMar.hs, simonMar.o )
 Linking simonMar ...
 da...@linux-mkk1:~/Haskell/CafeTesting> ./simonMar
 v: 0
 v: 0
 ()
 }}}
 However, with optimisations:
 {{{
 da...@linux-mkk1:~/Haskell/CafeTesting> touch simonMar.hs
 da...@linux-mkk1:~/Haskell/CafeTesting> ghc -O2 --make simonMar
 [1 of 1] Compiling Main ( simonMar.hs, simonMar.o )
 Linking simonMar ...
 da...@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:
 {{{
 da...@linux-mkk1:~/Haskell/CafeTesting> ghc --make tobOlau
 [1 of 1] Compiling Main ( tobOlau.hs, tobOlau.o )
 Linking tobOlau ...
 da...@linux-mkk1:~/Haskell/CafeTesting> ./tobOlau
 tobOlau: should never match this
 da...@linux-mkk1:~/Haskell/CafeTesting> touch tobOlau.hs
 da...@linux-mkk1:~/Haskell/CafeTesting> ghc -O --make tobOlau
 [1 of 1] Compiling Main ( tobOlau.hs, tobOlau.o )
 Linking tobOlau ...
 da...@linux-mkk1:~/Haskell/CafeTesting> ./tobOlau
 101
 da...@linux-mkk1:~/Haskell/CafeTesting> ghc --version
 The Glorious Glasgow Haskell Compilation System, version 6.10.1
 da...@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: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


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

2009-05-06 Thread GHC
#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 tobsan):

 When running the listed code under GNU/Linux on i686, the output is not
 the same as you listed.
  [to...@wobsi] $ ./st
  0
  0
  ()

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


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

2009-05-06 Thread GHC
#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|   Keywords:  
Difficulty:  Unknown   |   Testcase:  
Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
---+
 The following code:

 {{{
 module Main where

 import Control.Monad.ST.Lazy
 import Data.STRef.Lazy
 import Data.Array.ST
 import Int
 import Debug.Trace

 data Refs s = Refs
 { memory:: STArray s Int8 Int8
 , pc:: STRef s Int8
 }

 main :: IO ()
 main = do
 print $ runST m
   where
 m = do
   m <- newArray_ (0,30)
   p <- newSTRef 0
   let r = Refs m p
   writeArray m 0 0x4
   v <- readSTRef p
   modifySTRef p (+1)
   trace ("v: " ++ show v) $ return ()
   op <- readArray m v
   case trace ("v: " ++ show v) $ op of
   0x4 -> modifySTRef p (+100) -- should run this
   n   -> error ("should never match this: " ++ show n)
 }}}

 generates this output:

 {{{
 > ./st
 v: 0
 v: 1
 st: MArray: undefined array element
 }}}

 That is, the two instances of `trace (show v)` are printing different
 results, for the same v!

 Looking at the Core, the problem seems to be that a call to `readMutVar#`
 has been inlined and duplicated.  The `readMutVar#` primop doesn't have
 the `has_side_effects` flag set, and setting it (in `primops.txt.pp`)
 fixes it, but I'm not completely sure if that's the right fix.  If it is,
 then there are lots of other similar primops that also need that flag set.

 Bug report originally from a haskell-cafe post:
 [http://www.haskell.org/pipermail/haskell-cafe/2009-May/061010.html]

-- 
Ticket URL: 
GHC 
The Glasgow Haskell Compiler___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs