Re: [GHC] #3132: x86 code generator generates bad FPU register names
#3132: x86 code generator generates bad FPU register names ---+ Reporter: int-e |Owner: Type: bug | Status: new Priority: high|Milestone: 6.12.1 Component: Compiler (NCG) | Version: 6.11 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Os: Unknown/Multiple Architecture: x86 | ---+ Changes (by igloo): * status: reopened = new * owner: nobody = -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3132#comment:7 GHC http://www.haskell.org/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] #3132: x86 code generator generates bad FPU register names
#3132: x86 code generator generates bad FPU register names ---+ Reporter: int-e |Owner: nobody Type: bug | Status: closed Priority: high|Milestone: 6.12.1 Component: Compiler (NCG) | Version: 6.11 Severity: normal | Resolution: fixed Keywords: | Difficulty: Unknown Testcase: | Os: Unknown/Multiple Architecture: x86 | ---+ Changes (by simonmar): * status: new = closed * resolution: = fixed Comment: Fixed: {{{ Wed Jun 17 14:02:27 BST 2009 Simon Marlow marlo...@gmail.com * Fix #3132: a case of bogus code generation }}} -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3132#comment:5 GHC http://www.haskell.org/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] #3132: x86 code generator generates bad FPU register names
#3132: x86 code generator generates bad FPU register names ---+ Reporter: int-e |Owner: nobody Type: bug | Status: reopened Priority: high|Milestone: 6.12.1 Component: Compiler (NCG) | Version: 6.11 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Os: Unknown/Multiple Architecture: x86 | ---+ Changes (by simonmar): * status: closed = reopened * resolution: fixed = Comment: Ah, we need to leave this ticket open, as a reminder to investigate the issue in the new code generator. See comments in `codeGen/CgCase.lhs`, search for `3132`. The test case is in `codeGen/should_compile/3132.hs`. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3132#comment:6 GHC http://www.haskell.org/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] #3132: x86 code generator generates bad FPU register names
#3132: x86 code generator generates bad FPU register names ---+ Reporter: int-e |Owner: benl Type: bug | Status: new Priority: high|Milestone: 6.12.1 Component: Compiler (NCG) | Version: 6.11 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Os: Unknown/Multiple Architecture: x86 | ---+ Changes (by simonmar): * owner: = benl * cc: benl (added) Comment: Ben, would you care to look at this one? (if not, please just unassign yourself) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3132#comment:3 GHC http://www.haskell.org/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] #3132: x86 code generator generates bad FPU register names
#3132: x86 code generator generates bad FPU register names ---+ Reporter: int-e |Owner: nobody Type: bug | Status: new Priority: high|Milestone: 6.12.1 Component: Compiler (NCG) | Version: 6.11 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Os: Unknown/Multiple Architecture: x86 | ---+ Changes (by benl): * owner: benl = nobody Comment: The cmm code for the failing program contains the following: {{{ if (_c1Wu::I32 = 1) goto c1Wx; _s1Ba::F64 = r1tw_closure; _s1Nk::F64 = %MO_F_Sub_W64(D1, _s1Ba::F64); _s1Nl::F64 = %MO_F_Mul_W64(F64[Sp + 12], _s1Nk::F64); }}} Note that r1tw_closure is not a F64. Here is a test-case that fails -dcmm-lint as well as -dstg-lint when compiled with -O2. {{{ module Spring where import Data.Array.Unboxed type Arr= UArray Int Double step :: Double - Int - Arr - Arr step h sz y = listArray (0, 0) [] }}} {{{ ghc-stage1: panic! (the 'impossible' happened) (GHC version 6.11.20090514 for i386-unknown-linux): *** Stg Lint ErrMsgs: in Stg2Stg *** no location info: [in body of lambda with binders s{v sGe} [lid] :: ghc-prim:GHC.Prim.State#{(w) tc 32q} s{tv awN} [tv]] In a function application, function type doesn't match arg types: Function type: forall s{tv axt} [tv] i{tv axu} [tv]. (base:GHC.Arr.Ix{tc 2i} i{tv axu} [tv]) = (i{tv axu} [tv], i{tv axu} [tv]) - base:GHC.ST.ST{tc r65} s{tv axt} [tv] (array-0.2.0.1:Data.Array.Base.STUArray{tc r6} s{tv axt} [tv] i{tv axu} [tv] ghc-prim:GHC.Types.Double{(w) tc 3u}) Arg types: predbase:GHC.Arr.Ix{tc 2i} ghc-prim:GHC.Types.Int{(w) tc 3J} (ghc-prim:GHC.Types.Int{(w) tc 3J}, ghc-prim:GHC.Types.Int{(w) tc 3J}) ghc-prim:GHC.Prim.State#{(w) tc 32q} s{tv awN} [tv] Expression: array-0.2.0.1:Data.Array.Base.newArray_8{v ra} [gid] base:GHC.Arr.$f14{v r9} [gid] main:Spring.lvl1{v r8} [gid] s{v sGe} [lid] }}} I'm not sure how to read the STG code, but it looks like something in the libs has been messed up, which has then been inlined. Perhaps validate should be compiling with all the lint options turned on? -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3132#comment:4 GHC http://www.haskell.org/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] #3132: x86 code generator generates bad FPU register names
#3132: x86 code generator generates bad FPU register names ---+ Reporter: int-e |Owner: Type: bug | Status: new Priority: high|Milestone: 6.12 branch Component: Compiler (NCG) | Version: 6.11 Severity: normal | Resolution: Keywords: | Difficulty: Unknown Testcase: | Os: Unknown/Multiple Architecture: x86 | ---+ Changes (by simonmar): * priority: normal = high * difficulty: = Unknown * milestone: = 6.12 branch -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3132#comment:1 GHC http://www.haskell.org/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] #3132: x86 code generator generates bad FPU register names
#3132: x86 code generator generates bad FPU register names -+-- Reporter: int-e | Owner: Type: bug | Status: new Priority: normal| Component: Compiler (NCG) Version: 6.11 | Severity: normal Keywords:| Testcase: Os: Unknown/Multiple | Architecture: x86 -+-- The following code, {{{ module Spring where import Data.Array.Unboxed type Arr = UArray Int Double data Spring = Spring !Double !Int !Arr deriving Show step :: Double - Spring - Spring step h (Spring k sz y) = let f arr = listArray (0, 2*sz-1) (velocity ++ accel) where velocity = [arr ! i | i - [sz .. 2*sz-1]] k' = k * fromIntegral sz^2 accel= [0] ++ [k' * (arr!(i-1) - 2 * arr!i + arr!(i+1)) | i - [1 .. sz-2]] ++ [k' * (arr!(sz-2) - arr!(sz-1))] (.*) :: Double - Arr - Arr a .* b = listArray (0, 2*sz-1) $ map (a*) (elems b) (+) :: Arr - Arr - Arr a + b = listArray (0, 2*sz-1) $ zipWith (+) (elems a) (elems b) -- order 4 Runge-Kutta k1 = h .* f y k2 = h .* f (y + (0.5 .* k1)) k3 = h .* f (y + (0.5 .* k2)) k4 = h .* f (y + k3) y' = y + ((1/6) .* (k1 + (2 .* (k2 + k3)) + k4)) in Spring k sz y' }}} doesn't compile with optimization in ghc-6.11: {{{ # ghc -O -c Bug.hs /tmp/ghc12296_0/ghc12296_0.s: Assembler messages: /tmp/ghc12296_0/ghc12296_0.s:2355:0: Error: bad register name `%st(-8)' /tmp/ghc12296_0/ghc12296_0.s:2384:0: Error: bad register name `%st(-8)' /tmp/ghc12296_0/ghc12296_0.s:2563:0: Error: bad register name `%st(-8)' /tmp/ghc12296_0/ghc12296_0.s:2602:0: Error: bad register name `%st(-8)' /tmp/ghc12296_0/ghc12296_0.s:3006:0: Error: bad register name `%fake0' /tmp/ghc12296_0/ghc12296_0.s:3023:0: Error: bad register name `%fake0' }}} It's odd, first it tries to assign a closure pointer to an FPU register: {{{ movl $r1sa_closure,%fake0 }}} and later it uses register 0 (%eax) as an operand to an FPU operation: {{{ # gsubl %fake1,%eax,%fake1 #GSUB-xxxcase1 ffree %st(7) ; fld %st(-8) ; fsubrp %st(0),%st(2) }}} Using {{{-fregs-graph}}} didn't help. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3132 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler___ Glasgow-haskell-bugs mailing list Glasgow-haskell-bugs@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs