Simon Jakobi pushed to branch wip/sjakobi/T27507 at Glasgow Haskell Compiler / GHC Commits: a358c3f8 by Simon Jakobi at 2026-07-16T13:59:51+02:00 testsuite: Add simpler T27507 reproducer - - - - - 3 changed files: - + testsuite/tests/simplStg/should_run/T27507a.hs - + testsuite/tests/simplStg/should_run/T27507a.stdout - testsuite/tests/simplStg/should_run/all.T Changes: ===================================== testsuite/tests/simplStg/should_run/T27507a.hs ===================================== @@ -0,0 +1,28 @@ +{-# LANGUAGE BangPatterns #-} +-- Ensure the Box is returned boxed rather than unwrapped by CPR. +-- Ensure fun_exit is not floated to top, but works either way. +{-# OPTIONS_GHC -fno-cpr-anal -fno-full-laziness #-} + +module Main where + +import GHC.Exts (noinline) +import GHC.Exts.Heap (getClosureData, info, tipe) + +data Box a = Box !a + +foo :: Bool -> Int -> (Int, Box Int) +foo b !x = case x of + x' -> let -- Keep fun_exit monomorphic so that it can become a join point. + -- Without this signature its polymorphic result type prevents contification. + fun_exit :: Int -> Int -> (Int, Box Int) + fun_exit x_f i = (i, Box x_f) + {-# NOINLINE fun_exit #-} + in if b then fun_exit x' 0 else fun_exit x' 1 +{-# NOINLINE foo #-} + +main :: IO () +main = + case foo True 42 of + (_, bx) -> do + c <- noinline getClosureData bx + noinline print (tipe (info c)) ===================================== testsuite/tests/simplStg/should_run/T27507a.stdout ===================================== @@ -0,0 +1 @@ +CONSTR_1_0 ===================================== testsuite/tests/simplStg/should_run/all.T ===================================== @@ -24,3 +24,4 @@ test('T23783', normal, multimod_compile_and_run, ['T23783', '-O -v0']) test('unpack_enum', normal, compile_and_run, ['']) test('T27005a', normal, compile_and_run, ['']) test('T27507', normal, compile_and_run, ['']) +test('T27507a', normal, compile_and_run, ['']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a358c3f8c8458b18eb31bd161499f010... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a358c3f8c8458b18eb31bd161499f010... You're receiving this email because of your account on gitlab.haskell.org. Manage all notifications: https://gitlab.haskell.org/-/profile/notifications | Help: https://gitlab.haskell.org/help
participants (1)
-
Simon Jakobi (@sjakobi2)