Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,393
    • Issues 4,393
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 381
    • Merge Requests 381
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #13616

Closed
Open
Opened Apr 26, 2017 by Joachim Breitner@nomeataDeveloper

Old file used when later calls to GHC omit -dynamic-too

This may possibly only hurt few people who develop Plugins, but it is still quite annoying: If ghc, in --make mode, recompiles a plugin that it is going to use, but without -dynamic-too, it will create new .dyn and .o files, but it will happily use the old .dyn_hs or .dyn_o files that are still lying around.

I guess the desired behavior is: If it determines that it needs the dynamically compiled version of some module, and it is recompiling the module, then it should complain instead of later either ungracefully falling over the missing .dyn_o file or – worse – using an old one.

This script reproduces the issue: {{{ #!/bin/bash

rm -f *.o *.hi *.dyn_o *.dyn_hi

cat > Plugin.hs <<END module Plugin where import GhcPlugins plugin :: Plugin plugin = defaultPlugin { installCoreToDos = install }

install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo] install _ _ = error "First version" END

cat > Code.hs <<END # OPTIONS_GHC -O -fplugin Plugin # module Code where END

echo "No dynamic file found (fine, but the error message could be more helpful)"

ghc -package ghc Code.hs -fforce-recomp

echo "Compiling with -dynamic-too"

ghc -dynamic-too -package ghc Code.hs -fforce-recomp

cat > Plugin.hs <<END module Plugin where import GhcPlugins plugin :: Plugin plugin = defaultPlugin { installCoreToDos = install }

install :: [CommandLineOption] -> [CoreToDo] -> CoreM [CoreToDo] install _ _ = error "Second version" END

echo "Recompiling without -dynamic-too, it still uses the old file"

ghc -package ghc Code.hs -fforce-recomp

echo "Recompiling with -dynamic-too, now it works"

ghc -dynamic-too -package ghc Code.hs -fforce-recomp }}} And here is the slightly redacted output:

$ ./repro.sh 
No dynamic file found (fine, but the error message could be more helpful)
[1 of 2] Compiling Plugin           ( Plugin.hs, Plugin.o )
[2 of 2] Compiling Code             ( Code.hs, Code.o )
<no location info>: fatal:
    cannot find object file ‘./Plugin.dyn_o’
    while linking an interpreted expression

Compiling with -dynamic-too
[1 of 2] Compiling Plugin           ( Plugin.hs, Plugin.o )
[2 of 2] Compiling Code             ( Code.hs, Code.o )
ghc: panic! (the 'impossible' happened)
	First version

Recompiling without -dynamic-too, it still uses the old file
[1 of 2] Compiling Plugin           ( Plugin.hs, Plugin.o )
[2 of 2] Compiling Code             ( Code.hs, Code.o )
ghc: panic! (the 'impossible' happened)
	First version

Recompiling with -dynamic-too, now it works
[1 of 2] Compiling Plugin           ( Plugin.hs, Plugin.o )
[2 of 2] Compiling Code             ( Code.hs, Code.o )
ghc: panic! (the 'impossible' happened)
	Second version
Trac metadata
Trac field Value
Version 8.0.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#13616