diff options
author | Simon Peyton Jones <simonpj@microsoft.com> | 2019-07-08 15:09:52 +0100 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-07-09 23:01:24 -0400 |
commit | d2e290d3280841647354ddf5ca9abdd974bce0d5 (patch) | |
tree | f8e2274f28a725ed0a7d32753e3aefc64d2a69a2 /testsuite | |
parent | a35e091616a24b57c229cf50c8d43f8f6bfb5524 (diff) | |
download | haskell-d2e290d3280841647354ddf5ca9abdd974bce0d5.tar.gz |
Fix erroneous float in CoreOpt
The simple optimiser was making an invalid transformation
to join points -- yikes. The fix is easy.
I also added some documentation about the fact that GHC uses
a slightly more restrictive version of join points than does
the paper.
Fix #16918
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T16918.hs | 7 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/T16918a.hs | 25 | ||||
-rw-r--r-- | testsuite/tests/simplCore/should_compile/all.T | 2 |
3 files changed, 34 insertions, 0 deletions
diff --git a/testsuite/tests/simplCore/should_compile/T16918.hs b/testsuite/tests/simplCore/should_compile/T16918.hs new file mode 100644 index 0000000000..87113b4d96 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T16918.hs @@ -0,0 +1,7 @@ +module Bug where + +pokeArray :: () -> () +pokeArray = pokeArray + +pokeSockAddr :: String -> () -> () +pokeSockAddr path p = (case path of ('\0':_) -> pokeArray) p diff --git a/testsuite/tests/simplCore/should_compile/T16918a.hs b/testsuite/tests/simplCore/should_compile/T16918a.hs new file mode 100644 index 0000000000..8b676f83c4 --- /dev/null +++ b/testsuite/tests/simplCore/should_compile/T16918a.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE ForeignFunctionInterface #-} +module Bug where + +import Data.Word +import Foreign +import Foreign.C.String +import Foreign.C.Types + +type CSaFamily = (Word16) +data SockAddr = SockAddrUnix String + +pokeSockAddr :: Ptr a -> SockAddr -> IO () +pokeSockAddr p (SockAddrUnix path) = do + case path of + ('\0':_) -> zeroMemory p (110) + _ -> return () + ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) p ((1) :: CSaFamily) + let pathC = map castCharToCChar path + poker = case path of ('\0':_) -> pokeArray; _ -> pokeArray0 0 + poker (((\hsc_ptr -> hsc_ptr `plusPtr` 2)) p) pathC + +foreign import ccall unsafe "string.h" memset :: Ptr a -> CInt -> CSize -> IO () + +zeroMemory :: Ptr a -> CSize -> IO () +zeroMemory dest nbytes = memset dest 0 (fromIntegral nbytes) diff --git a/testsuite/tests/simplCore/should_compile/all.T b/testsuite/tests/simplCore/should_compile/all.T index 2fbe84a49e..768012d451 100644 --- a/testsuite/tests/simplCore/should_compile/all.T +++ b/testsuite/tests/simplCore/should_compile/all.T @@ -303,3 +303,5 @@ test('T15631', test('T15673', normal, compile, ['-O']) test('T16288', normal, multimod_compile, ['T16288B', '-O -dcore-lint -v0']) test('T16348', normal, compile, ['-O']) +test('T16918', normal, compile, ['-O']) +test('T16918a', normal, compile, ['-O']) |