Magnus pushed to branch wip/mangoiv/27556 at Glasgow Haskell Compiler / GHC

Commits:

6 changed files:

Changes:

  • changelog.d/27556
    1
    +section: compiler
    
    2
    +synopsis: Remove a too strict assert in coreprep; fixes a bug where debug builds
    
    3
    +    of GHC would fail to compile correctly optimized programs.
    
    4
    +mrs: !16558
    
    5
    +issues: #27556

  • compiler/GHC/CoreToStg/Prep.hs
    ... ... @@ -1260,10 +1260,9 @@ cpeApp top_env expr
    1260 1260
     
    
    1261 1261
           -- See Note [Ticks and mandatory eta expansion]
    
    1262 1262
           AITick tickish
    
    1263
    -        | tickishPlace tickish == PlaceRuntime
    
    1263
    +        | PlaceRuntime <- tickishPlace tickish
    
    1264 1264
             , req_depth > 0
    
    1265
    -        -> assert (isProfTick tickish) $
    
    1266
    -           rebuild_app' env as fun' floats ss (tickish:rt_ticks) req_depth
    
    1265
    +        -> rebuild_app' env as fun' floats ss (tickish:rt_ticks) req_depth
    
    1267 1266
             | otherwise
    
    1268 1267
             -- See [Floating Ticks in CorePrep]
    
    1269 1268
             -> rebuild_app' env as fun' (snocFloat floats (FloatTick tickish)) ss rt_ticks req_depth
    

  • compiler/GHC/Types/Tickish.hs
    ... ... @@ -13,7 +13,6 @@ module GHC.Types.Tickish (
    13 13
       mkNoCount,
    
    14 14
       mkNoScope,
    
    15 15
       tickishIsCode,
    
    16
    -  isProfTick,
    
    17 16
       TickishPlacement(..),
    
    18 17
       tickishPlace,
    
    19 18
       tickishContains,
    
    ... ... @@ -545,10 +544,6 @@ tickishIsCode ProfNote{} = True
    545 544
     tickishIsCode Breakpoint{} = True
    
    546 545
     tickishIsCode HpcTick{}    = True
    
    547 546
     
    
    548
    -isProfTick :: GenTickish pass -> Bool
    
    549
    -isProfTick ProfNote{} = True
    
    550
    -isProfTick _          = False
    
    551
    -
    
    552 547
     -- | Governs the kind of expression that the tick gets placed on when
    
    553 548
     -- annotating for example using @mkTick@. If we find that we want to
    
    554 549
     -- put a tickish on an expression ruled out here, we try to float it
    

  • testsuite/tests/simplCore/should_compile/T27556.hs
    1
    +import Control.Exception
    
    2
    +
    
    3
    +main = mask $ \restore -> restore (pure ())
    
    4
    +

  • testsuite/tests/simplCore/should_compile/T27556.script
    1
    +:l T27556

  • testsuite/tests/simplCore/should_compile/all.T
    ... ... @@ -611,3 +611,4 @@ test('T27296', [], makefile_test, ['T27296'])
    611 611
     test('T27296b', [], makefile_test, ['T27296b'])
    
    612 612
     test('T27589', [grep_errmsg(r'wombat')], compile, ['-O -ddump-simpl -dno-typeable-binds -dsuppress-uniques'])
    
    613 613
     test('T27590', [grep_errmsg(r'wombat')], compile, ['-O -ddump-simpl -dno-typeable-binds -dsuppress-uniques'])
    
    614
    +test('T27556', [only_ways('ghci'), extra_hc_opts('-O -fno-unoptimized-core-for-interpreter')], ghci_script, ['T27556.script'])