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,843
    • Issues 4,843
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 453
    • Merge requests 453
  • 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
  • #14769

Closed
Open
Created Feb 06, 2018 by Niklas Hambüchen@nh2Reporter

The RecompBecause [TH] check is not resume-build-safe

ghc --make aims to make compilation behave correctly and produce up-to-date, no matter whether it completes or is interrupted (e.g. with Ctrl+C) and later resumed

At no point should interrupting a build and running it again produce "less correct" outputs than running it to the end; specifically interrupting shouldn't result in necessary build steps to be "forgotten".

However, this seems to be the case with the [TH] check introduced in #481 (closed).

Minimal test case with 3 files: https://github.com/nh2/th-recomp-test

Good behaviour when running without interrupting:

% touch A.hs && ~/.stack/programs/x86_64-linux/ghc-8.0.1/bin/ghc --make Main.hs           
[1 of 3] Compiling A                ( A.hs, A.o )
[2 of 3] Compiling B                ( B.hs, B.o ) [TH]
[3 of 3] Compiling Main             ( Main.hs, Main.o ) [TH]
Linking Main ...

Bad behaviour when interrupting and running again:

% touch A.hs; timeout 0.1 ~/.stack/programs/x86_64-linux/ghc-8.0.1/bin/ghc --make Main.hs; ~/.stack/programs/x86_64-linux/ghc-8.0.1/bin/ghc --make Main.hs
[1 of 3] Compiling A                ( A.hs, A.o )
[2 of 3] Compiling B                ( B.hs, B.o ) [TH]
Linking Main ...

As you can see, when interrupting, the step Compiling Main ( Main.hs, Main.o ) [TH] went missing.

This suggests to me that either:

  • the [TH]s are unnecessary in the first place (unlikely and I buy into the reason explained by #481 (closed) that changed values may be picked up by TH in higher-level modules)
  • the resumed ghc --make invocation may potentially produce wrong / not-up-to-date outputs (most likely)
  • re-running somehow retrieves the information that in fact recompiling Main is not necessary for a correct build (if this is the case, then I'd really like to know how that works and we should document it, likely also try to use that way to avoid recompiling Main in the uninterrupted run)
Trac metadata
Trac field Value
Version 8.2.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC nh2, simonmar
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