Test Trac #8037
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 8 Nov 2013 10:52:14 +0000 (10:52 +0000)
committerSimon Peyton Jones <simonpj@microsoft.com>
Fri, 8 Nov 2013 10:52:26 +0000 (10:52 +0000)
testsuite/tests/stranal/should_compile/T8037.hs [new file with mode: 0644]
testsuite/tests/stranal/should_compile/all.T

diff --git a/testsuite/tests/stranal/should_compile/T8037.hs b/testsuite/tests/stranal/should_compile/T8037.hs
new file mode 100644 (file)
index 0000000..62d2a13
--- /dev/null
@@ -0,0 +1,17 @@
+module T8037 where\r
+\r
+import Unsafe.Coerce\r
+import Foreign.C.Types\r
+import System.IO.Unsafe\r
+\r
+data D4 = D4 CInt CInt CInt\r
+data Color3 = Color3 CInt CInt\r
+\r
+crash :: D4 -> IO ()\r
+crash x = color (unsafeCoerce x)\r
+\r
+color :: Color3 -> IO ()\r
+color (Color3 r g) = f (unsafePerformIO undefined) r g\r
+\r
+foreign import ccall f :: CInt -> CInt -> CInt -> IO ()\r
+\r
index 9467a7e..7ee45ad 100644 (file)
@@ -17,3 +17,4 @@ test('unu', normal, compile, [''])
 test('newtype', req_profiling, compile, ['-prof -auto-all'])
 test('T1988', normal, compile, [''])
 test('T8467', normal, compile, [''])
+test('T8037', normal, compile, [''])