[Git][ghc/ghc][wip/sjakobi/T27368] testsuite: Add regression test for #27368
Simon Jakobi pushed to branch wip/sjakobi/T27368 at Glasgow Haskell Compiler / GHC Commits: 4ff5d4da by Simon Jakobi at 2026-06-11T13:45:48+02:00 testsuite: Add regression test for #27368 The test distills the code shape that made setInfoTableStackMap panic when compiling GHC.CmmToAsm.Dwarf.Types with -O2 on top of !16168: two branches with identical suffixes from a three-constructor case onwards. Common block elimination merges the duplicated call blocks across the branches and leaves the losing copies unreachable in the block map, with a continuation label that is itself unreachable. Also panics unfixed released compilers (GHC 9.12.2 and 9.14.1). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> - - - - - 2 changed files: - + testsuite/tests/codeGen/should_compile/T27368.hs - testsuite/tests/codeGen/should_compile/all.T Changes: ===================================== testsuite/tests/codeGen/should_compile/T27368.hs ===================================== @@ -0,0 +1,20 @@ +-- Regression test for #27368: setInfoTableStackMap panicked because +-- callProcPoints collected the continuation of a call in an unreachable +-- block. The two branches below have identical suffixes from the inner +-- case onwards; common block elimination merges the duplicated call +-- blocks but leaves the losing copies in the block map, where the dead +-- call's continuation label is itself unreachable. +module T27368 (f) where + +{-# NOINLINE put #-} +put :: Int -> Int -> IO () +put h x = if h + x == 12345 then errorWithoutStackTrace "boom" else pure () + +data T = N | J Int | K + +f :: Int -> Bool -> T -> IO () +f h a t = do + if a + then do put h 1; case t of { N -> pure (); J _ -> put h 3; K -> put h 4 }; put h 0; put h 0 + else do put h 2; case t of { N -> pure (); J _ -> put h 3; K -> put h 4 }; put h 0; put h 0 + put h 0 ===================================== testsuite/tests/codeGen/should_compile/all.T ===================================== @@ -150,3 +150,5 @@ test('T16351', normal, compile, ['-O2 -ddump-simpl -dno-typeable-binds -dsuppres test('T20298a', normal, compile, ['-O2 -ddump-simpl -dno-typeable-binds -dsuppress-all -dsuppress-uniques']) test('T20298b', normal, compile, ['-O2 -dno-bignum-rules -ddump-simpl -dno-typeable-binds -dsuppress-all -dsuppress-uniques']) test('T20298c', normal, compile, ['-O2 -dno-builtin-rules -ddump-simpl -dno-typeable-binds -dsuppress-all -dsuppress-uniques']) + +test('T27368', normal, compile, ['-O2']) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4ff5d4daff5bde31cd051aa1e5a62959... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4ff5d4daff5bde31cd051aa1e5a62959... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Simon Jakobi (@sjakobi2)