Commit 6a0aeca3 authored by Simon Peyton Jones's avatar Simon Peyton Jones

Test Trac #3118

parent bf81cb80
-- Test Trac #3118
-- The test is quite delicate. It aims to get 'f' to look like
-- f y = case x of
-- Red -> (y, y)
-- _ -> let v = case x of
-- Green -> 2
-- Blue -> 3
-- in (v, 5)
--
-- And now float the inner case to top level
-- so that it's not so obvious that the Red case
-- cannot occur. This crashed GHC 6.10.
--
-- It's delicate to make the bug show up
-- (a) because it relies on not "seeing" that
-- x = Red until later.
-- (b) because dropping the Red case must happen
-- before float-out, which itself happens v early
-- In the original report, the x=Red was concealed by profiling
module T3118 where
data Colour = Red | Green | Blue
{-# NOINLINE [0] f #-}
g x = Red
x = g True
f :: Int -> (Int,Int)
f y = case x of
Red -> (y, y)
xx -> let v = case xx of
Red -> 1
Green -> 2
Blue -> 3
in (v, 5)
...@@ -36,4 +36,5 @@ test('spec003', normal, compile, ['']) ...@@ -36,4 +36,5 @@ test('spec003', normal, compile, [''])
test('rule1', normal, compile, ['']) test('rule1', normal, compile, [''])
test('strict-float', normal, compile, ['']) test('strict-float', normal, compile, [''])
test('T3118', normal, compile, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment