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,830
    • Issues 4,830
    • 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
  • #8572

Closed
Open
Created Nov 28, 2013 by parcs@trac-parcs

Building an empty module with profiling requires profiling libraries for integer-gmp

{-# LANGUAGE NoImplicitPrelude #-}
module A where
$ ghc-stage2 -prof -c A.hs

Top level:
    Failed to load interface for ‛GHC.Integer.Type’
    Perhaps you haven't installed the profiling libraries for package ‛integer-gmp’?
    Use -v to see a list of the files searched for.

I can't built module A without profiling libraries for integer-gmp, even though I don't use integer-gmp anywhere in the module.

This happens because the Tidy Core pass attempts to look up the mkInteger name (in order to desugar integer literals) even when there are no integer literals in the module.

The obvious fix is to lazily look up mkInteger in Coreprep.lookupMkIntegerName:

diff --git a/compiler/coreSyn/CorePrep.lhs b/compiler/coreSyn/CorePrep.lhs
index 5e0cd65..9836982 100644
--- a/compiler/coreSyn/CorePrep.lhs
+++ b/compiler/coreSyn/CorePrep.lhs
@@ -56,6 +56,7 @@ import Config
 import Data.Bits
 import Data.List        ( mapAccumL )
 import Control.Monad
+import System.IO.Unsafe ( unsafeInterleaveIO )
 \end{code}

 -- ---------------------------------------------------------------------------
@@ -1119,6 +1120,7 @@ lookupMkIntegerName dflags hsc_env
       else if thisPackage dflags == integerPackageId
       then return $ panic "Can't use Integer in integer"
       else liftM tyThingId
+         $ unsafeInterleaveIO
          $ initTcForLookup hsc_env (tcLookupGlobal mkIntegerName)

 mkInitialCorePrepEnv :: DynFlags -> HscEnv -> IO CorePrepEnv

This way, we don't attempt to look up mkInteger until we actually need it, i.e. if there are integer literals that we must desugar.

Relevant commits are 2ef5cd26 and fdd552e0

Trac metadata
Trac field Value
Version 7.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
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