|
#6156: Optimiser bug on linux-powerpc
-----------------------------------------+---------------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.4.1 | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Testcase: Blockedby: | Blocking: Related: | -----------------------------------------+---------------------------------- Found a small chunk of code in the cryptocipher package that when compiled and run, produces a difference result when optimised compared to compiling un-optimised. Note this is only a problem with PowerPC. On x86-64 there is no difference in the output between the optimised version and the un-optimised version. I have two simple files (Camellia.hs): {{{ module Camellia where import Data.Bits import Data.Word import Debug.Trace fl :: Word64 -> Word64 -> Word64 fl fin sk = let (x1, x2) = w64tow32 fin in let (k1, k2) = w64tow32 sk in let y2 = x2 `xor` ((x1 .&. k1) `rotateL` 1) in let y1 = x1 `xor` (y2 .|. k2) in trace (show fin ++ " " ++ show sk ++ " -> " ++ show (w32tow64 (y1, y2))) $ w32tow64 (y1, y2) w64tow32 :: Word64 -> (Word32, Word32) w64tow32 w = (fromIntegral (w `shiftR` 32), fromIntegral (w .&. 0xffffffff)) w32tow64 :: (Word32, Word32) -> Word64 w32tow64 (x1, x2) = ((fromIntegral x1) `shiftL` 32) .|. (fromIntegral x2) }}} and a main program (camellia-test.hs): {{{ import Data.Word import qualified Camellia as Camellia a, b :: Word64 a = 1238988323332265734 b = 11185553392205053542 main :: IO () main = putStrLn $ "Camellia.fl " ++ show a ++ " " ++ show b ++ " -> " ++ show (Camellia.fl a b) }}} I'm also using this Makefile: {{{ TARGETS = camilla-test-std camilla-test-opt check : $(TARGETS) ./camilla-test-std ./camilla-test-opt clean : make clean-temp-files rm -f $(TARGETS) clean-temp-files : rm -f camilla-test.o camilla-test.hi Camellia.o Camellia.hi camilla-test-opt : camilla-test.hs Camellia.hs ghc -Wall -O2 --make -i:Tests $< -o $@ make clean-temp-files camilla-test-std : camilla-test.hs Camellia.hs ghc -Wall --make -i:Tests $< -o $@ make clean-temp-files }}} When I run the two programs I get: {{{ ./camilla-test-std 1238988323332265734 11185553392205053542 -> 18360184157246690566 Camellia.fl 1238988323332265734 11185553392205053542 -> 18360184157246690566 ./camilla-test-opt 1238988323332265734 11185553392205053542 -> 3698434091925017862 Camellia.fl 38662 15974 -> 3698434091925017862 }}} So there are two problems here: a) Showing Word64 values is not working correctly in the optimised version. b) The function Camelia.fl produces the wrong result in the optimised version. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
#6156: Optimiser bug on linux-powerpc
-----------------------------------------+---------------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.4.1 | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Testcase: Blockedby: | Blocking: Related: | -----------------------------------------+---------------------------------- Comment(by erikd): Just tested this with GHC compiled from git HEAD and the optimised and un- optimised versions give the same results. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
-----------------------------------------+---------------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.4.1 | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Testcase: Blockedby: | Blocking: Related: | -----------------------------------------+---------------------------------- Comment(by erikd): This was likely fixed in bug #5900 which resulted in this patch: http://hackage.haskell.org/trac/ghc/changeset/bee6f865d8c747aa821f9d4996ad3300429fd55c -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
-----------------------------------------+---------------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.4.1 | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Testcase: Blockedby: | Blocking: Related: | -----------------------------------------+---------------------------------- Comment(by erikd): Hmm, interesting! The patch from bug #5900 doesn't fix this. Now trying 7.4.2. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------+--------------------------------------------------- Reporter: erikd | Owner: Type: bug | Status: closed Priority: normal | Component: Compiler Version: 7.4.1 | Resolution: fixed Keywords: | Os: Linux Architecture: powerpc | Failure: Incorrect result at runtime Testcase: | Blockedby: Blocking: | Related: ------------------------+--------------------------------------------------- Changes (by erikd): * status: new => closed * resolution: => fixed Comment: Confirmed fixed in ghc 7.4.2. Closing this bug. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------+--------------------------------------------------- Reporter: erikd | Owner: Type: bug | Status: closed Priority: normal | Component: Compiler Version: 7.4.1 | Resolution: fixed Keywords: | Os: Linux Architecture: powerpc | Failure: Incorrect result at runtime Testcase: | Blockedby: Blocking: | Related: ------------------------+--------------------------------------------------- Comment(by nomeata): Hi, as Debian cannot upgrade to ghc 7.4.2 at this stage (http://lists.debian.org/debian-haskell/2012/06/msg00038.html) we need to backport the fix to 7.4.1. If it is not the patch from #5900, what else is it? -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------+--------------------------------------------------- Reporter: erikd | Owner: Type: bug | Status: closed Priority: normal | Component: Compiler Version: 7.4.1 | Resolution: fixed Keywords: | Os: Linux Architecture: powerpc | Failure: Incorrect result at runtime Testcase: | Blockedby: Blocking: | Related: ------------------------+--------------------------------------------------- Comment(by nomeata): Replying to [comment:3 erikd]: > Hmm, interesting! > > The patch from bug #5900 doesn't fix this. Now trying 7.4.2. Are you sure it does not fix it? I just read through the diff between 7.4.1 and 7.4.2, and could not find any other related code. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------+--------------------------------------------------- Reporter: erikd | Owner: Type: bug | Status: closed Priority: normal | Component: Compiler Version: 7.4.1 | Resolution: fixed Keywords: | Os: Linux Architecture: powerpc | Failure: Incorrect result at runtime Testcase: | Blockedby: Blocking: | Related: ------------------------+--------------------------------------------------- Comment(by erikd): Not sure what I did wrong the first time, but the fix for #5900 does indeed fix this problem. I'll update the debian packaging metadata for 7.4.1. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------+--------------------------------------------------- Reporter: erikd | Owner: Type: bug | Status: closed Priority: normal | Component: Compiler Version: 7.4.1 | Resolution: fixed Keywords: | Os: Linux Architecture: powerpc | Failure: Incorrect result at runtime Testcase: | Blockedby: Blocking: | Related: ------------------------+--------------------------------------------------- Comment(by nomeata): Replying to [comment:7 erikd]: > Not sure what I did wrong the first time, but the fix for #5900 does indeed fix this problem. I wish you were right, but cryptocipher just failed to build on powerpc, using a patched GHC 7.4.1 that includes your patch (http://anonscm.debian.org/darcs/pkg-haskell/ghc/patches/fix-PPC-right- shift-bug to be precise), here is the build log: https://buildd.debian.org/status/fetch.php?pkg=haskell- cryptocipher&arch=powerpc&ver=0.3.5-1&stamp=1339953314 Any idea? -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------+--------------------------------------------------- Reporter: erikd | Owner: Type: bug | Status: closed Priority: normal | Component: Compiler Version: 7.4.1 | Resolution: fixed Keywords: | Os: Linux Architecture: powerpc | Failure: Incorrect result at runtime Testcase: | Blockedby: Blocking: | Related: ------------------------+--------------------------------------------------- Comment(by erikd): Bah!! Failing here as well now. Let me bash on this some more. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------+--------------------------------------------------- Reporter: erikd | Owner: Type: bug | Status: closed Priority: normal | Component: Compiler Version: 7.4.1 | Resolution: fixed Keywords: | Os: Linux Architecture: powerpc | Failure: Incorrect result at runtime Testcase: | Blockedby: Blocking: | Related: ------------------------+--------------------------------------------------- Comment(by nomeata): Anything new on this front? This is currently preventing Debian wheezy from shipping with yesod. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------------------------+--------------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.4.1 Resolution: | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------------------+--------------------------------- Changes (by simonpj): * status: closed => new * difficulty: => Unknown * resolution: fixed => Comment: At the GHC end I think we are stalled awaiting a reproducible test case. Indeed the ticket is closed Do re-open if anyone can find one. Mind you, there is no regression test, which is bad. I'll re-open and assign to Paolo to add one. Is that OK Paolo? Need to test both with and without optimisation. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:11> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------------------------+--------------------------------- Reporter: erikd | Owner: pcapriotti Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.4.1 Resolution: | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------------------+--------------------------------- Changes (by simonpj): * owner: => pcapriotti -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:12> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------------------------+--------------------------------- Reporter: erikd | Owner: pcapriotti Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.4.1 Resolution: | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------------------+--------------------------------- Comment(by erikd): The two files I posted in the original bug report are the test case. Should I add the to the test suite and send a patch? -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:13> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------------------------+--------------------------------- Reporter: erikd | Owner: pcapriotti Type: bug | Status: new Priority: normal | Milestone: 7.6.1 Component: Compiler | Version: 7.4.1 Resolution: | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------------------+--------------------------------- Changes (by pcapriotti): * milestone: => 7.6.1 Comment: I added the `Camellia` example in this ticket as a test case for #5900. I'll keep this ticket open to track the failure in `cryptocipher`. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:14> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------------------------+--------------------------------- Reporter: erikd | Owner: pcapriotti Type: bug | Status: new Priority: normal | Milestone: 7.6.1 Component: Compiler | Version: 7.4.1 Resolution: | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------------------+--------------------------------- Comment(by simonpj): I'm confused. Is there a bug in `crryptocipher`? In that case it doesn't belong on GHC's bug tracker? Or in GHC? In which case how do we reproduce it? Simon -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:15> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------------------------+--------------------------------- Reporter: erikd | Owner: pcapriotti Type: bug | Status: new Priority: normal | Milestone: 7.6.1 Component: Compiler | Version: 7.4.1 Resolution: | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------------------+--------------------------------- Comment(by erikd): @simonpj : This is not a cryptocipher bug, its an GHC optimiser bug which was first found in the cryptocipher package. The code in the original bug report was a snippet of code from cryptocipher. Interestingly, the bug only shows itself on PowerPC. @pcapriotti : The testsuite file you updated (tests/codeGen/should_run/T5900.hs) probably won't trigger this bug, because in my testing, it would only appear when the function `fl` appeared in a separate module. Maybe a cross module inlining problem? Unfortunately I am not in a position to test this at the moment because whenever I try to compile GHC HEAD from git, I hit bug #6167. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:16> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------------------------+--------------------------------- Reporter: erikd | Owner: pcapriotti Type: bug | Status: new Priority: normal | Milestone: 7.6.1 Component: Compiler | Version: 7.4.1 Resolution: | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------------------+--------------------------------- Comment(by simonpj): Thanks. If it was possible to give a reproducible test case (even if power-pc only) that would be v helpful. Sounds as if erikd is working on #6167. Simon -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:17> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------------------------+--------------------------------- Reporter: erikd | Owner: pcapriotti Type: bug | Status: new Priority: normal | Milestone: 7.6.1 Component: Compiler | Version: 7.4.1 Resolution: | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------------------+--------------------------------- Comment(by pcapriotti): @erikd: Sorry, I haven't actually reproduced the problem here (I don't have access a ppc machine at the moment). Did I understand correctly that the issue in the `Camellia` example in this ticket is fixed by the patch in #5900? I'm not sure why splitting it into two modules would make any difference there, though. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:18> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
|
In reply to this post by GHC
#6156: Optimiser bug on linux-powerpc
------------------------------------------+--------------------------------- Reporter: erikd | Owner: pcapriotti Type: bug | Status: new Priority: normal | Milestone: 7.6.1 Component: Compiler | Version: 7.4.1 Resolution: | Keywords: Os: Linux | Architecture: powerpc Failure: Incorrect result at runtime | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ------------------------------------------+--------------------------------- Comment(by erikd): @pcapriotti : No this issue is not fixed by the patch in #5900. The Debian Haskell Group hit this issue first with an unpatched (wrt #5900) version of ghc (7.4.1 I believe). I then tested it with 7.4.2 (which is patched wrt #5900) and ghc HEAD at the time. 7.4.2 displayed the problem and ghc HEAD did not. I was not able to figure out why 7.4.2 had a problem and HEAD did not. -- Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6156#comment:19> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ Glasgow-haskell-bugs mailing list [hidden email] http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs |
| Powered by Nabble | Edit this page |
