[GHC] #9245: In absence of recursive imports, hs-boot files not checked for consistency
#9245: In absence of recursive imports, hs-boot files not checked for consistency -----------------------------------+--------------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time crash Unknown/Multiple | Test Case: Difficulty: Unknown | Blocking: Blocked By: | Related Tickets: | -----------------------------------+--------------------------------------- Example: B.hs-boot {{{ module B where b :: Bool }}} A.hs {{{ module A where import {-# SOURCE #-} B a = b }}} B.hs {{{ module B where }}} Main.hs {{{ import A main = print a }}} Compilation: {{{ ghc -c B.hs-boot ghc -c A.hs ghc -c B.hs ghc -c Main.hs ghc -o main A.o B.o Main.o }}} Error: {{{A.o:(.text+0x79): undefined reference to `B_b_closure' A.o: In function `A_a_srt': (.data+0x0): undefined reference to `B_b_closure' collect2: error: ld returned 1 exit status }}} The culprit seems to be this code: {{{ -- OK, so we're in one-shot mode. -- In that case, we're read all the direct imports by now, -- so eps_is_boot will record if any of our imports mention us by -- way of hi-boot file { eps <- getEps ; case lookupUFM (eps_is_boot eps) (moduleName mod) of { Nothing -> return emptyModDetails ; -- The typical case Just (_, False) -> failWithTc moduleLoop ; -- Someone below us imported us! -- This is a loop with no hi-boot in the way Just (_mod, True) -> -- There's a hi-boot interface below us }}} but I am not 100% sure what the correct new logic is yet. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9245> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9245: In absence of recursive imports, hs-boot files not checked for consistency ---------------------------------------+----------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Description changed by ezyang: Old description:
Example:
B.hs-boot {{{ module B where b :: Bool }}}
A.hs {{{ module A where import {-# SOURCE #-} B a = b }}}
B.hs {{{ module B where }}}
Main.hs {{{ import A main = print a }}}
Compilation:
{{{ ghc -c B.hs-boot ghc -c A.hs ghc -c B.hs ghc -c Main.hs ghc -o main A.o B.o Main.o }}}
Error: {{{A.o:(.text+0x79): undefined reference to `B_b_closure' A.o: In function `A_a_srt': (.data+0x0): undefined reference to `B_b_closure' collect2: error: ld returned 1 exit status }}}
The culprit seems to be this code:
{{{ -- OK, so we're in one-shot mode. -- In that case, we're read all the direct imports by now, -- so eps_is_boot will record if any of our imports mention us by -- way of hi-boot file { eps <- getEps ; case lookupUFM (eps_is_boot eps) (moduleName mod) of { Nothing -> return emptyModDetails ; -- The typical case
Just (_, False) -> failWithTc moduleLoop ; -- Someone below us imported us! -- This is a loop with no hi-boot in the way
Just (_mod, True) -> -- There's a hi-boot interface below us }}}
but I am not 100% sure what the correct new logic is yet.
New description: Example: B.hs-boot {{{ module B where b :: Bool }}} A.hs {{{ module A where import {-# SOURCE #-} B a = b }}} B.hs {{{ module B where }}} Main.hs {{{ import A main = print a }}} Compilation: {{{ ghc -c B.hs-boot ghc -c A.hs ghc -c B.hs ghc -c Main.hs ghc -o main A.o B.o Main.o }}} Error: {{{ A.o:(.text+0x79): undefined reference to `B_b_closure' A.o: In function `A_a_srt': (.data+0x0): undefined reference to `B_b_closure' collect2: error: ld returned 1 exit status }}} The culprit seems to be this code: {{{ -- OK, so we're in one-shot mode. -- In that case, we're read all the direct imports by now, -- so eps_is_boot will record if any of our imports mention us by -- way of hi-boot file { eps <- getEps ; case lookupUFM (eps_is_boot eps) (moduleName mod) of { Nothing -> return emptyModDetails ; -- The typical case Just (_, False) -> failWithTc moduleLoop ; -- Someone below us imported us! -- This is a loop with no hi-boot in the way Just (_mod, True) -> -- There's a hi-boot interface below us }}} but I am not 100% sure what the correct new logic is yet. -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9245#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9245: In absence of recursive imports, hs-boot files not checked for consistency ---------------------------------------+----------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Comment (by ezyang): https://phabricator.haskell.org/D30 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9245#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9245: In absence of recursive imports, hs-boot files not checked for consistency ---------------------------------------+----------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.9 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Comment (by Edward Z. Yang <ezyang@…>): In [changeset:"0763a2f2eec4f6d9933fe17ee0d4a3a57823e6bf/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="0763a2f2eec4f6d9933fe17ee0d4a3a57823e6bf" Fix #9245 by always checking hi-boot for consistency if we find one. Summary: What this fix does is reorder how we look for hi-boot files: we unconditionally check for an hi-boot file, and if we don't find one, we check the import graph to see if there was circularity. This is as opposed to the previous scheme (check for circularity, then load hi-boot file). This costs us an extra file system access every typecheck, which is not the best. Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu> Test Plan: Validate and check for compiler regressions in nofib Reviewers: simonpj, austin Subscribers: simonmar, relrod, carter Differential Revision: https://phabricator.haskell.org/D30 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9245#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9245: In absence of recursive imports, hs-boot files not checked for consistency ---------------------------------------+----------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.9 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Changes (by ezyang): * status: new => closed * resolution: => fixed -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9245#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9245: In absence of recursive imports, hs-boot files not checked for consistency ---------------------------------------+----------------------------------- Reporter: ezyang | Owner: ezyang Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.9 Resolution: fixed | Keywords: backpack Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Changes (by ezyang): * keywords: => backpack -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9245#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC