
#10665: INLINE breaks rewrite rules when '-g' is used -------------------------------------+------------------------------------- Reporter: slyfox | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2-rc2 (CodeGen) | Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time Unknown/Multiple | crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- The bug is found when building conduit-1.2.4.2 package with '-O2 -g' options. The distilled sample looks like that: {{{#!hs {-# LANGUAGE BangPatterns #-} module RewriteBug (bug) where bug :: () -> () bug () = bug () {-# NOINLINE bug #-} a2 :: () a2 = () {-# INLINE[1] a2 #-} {-# RULES "bug a2" [0] bug a2 = () #-} {- Crashes as: $ inplace/bin/ghc-stage2 -c -O1 -fforce-recomp RewriteBug.hs -g ghc-stage2: panic! (the 'impossible' happened) (GHC version 7.11.20150721 for x86_64-unknown-linux): Tick in rule () -} }}} My theory of sequence of actions is the following: - rewrite rule gets read as-is by GHC (gentle phase) - a2 INLINE changes LHS of rewrite rule (phase 1) - when time comes to apply 'bug a2' rule GHC detects INLINE problem (phase 0) In real code it happened across multiple files. The bug is reproducible in both ghc-7.10.2-rc2 and today's HEAD. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10665 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler