Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,828
    • Issues 4,828
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 447
    • Merge requests 447
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #10665

Closed
Open
Created Jul 21, 2015 by Sergei Trofimovich@trofiReporter

INLINE breaks rewrite rules when '-g' is used

The bug is found when building conduit-1.2.4.2 package with '-O2 -g' options. The distilled sample looks like that:

{-# 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.

Trac metadata
Trac field Value
Version 7.10.2-rc2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (CodeGen)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC scpmw, simonpj
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking