Skip to content
GitLab
Projects Groups Snippets
  • /
  • 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 5,248
    • Issues 5,248
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 564
    • Merge requests 564
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #9741
Closed
Open
Issue created Oct 29, 2014 by Simon Peyton Jones@simonpjDeveloper

Interpreter stack checks are not quite right

In my experimental branch, I'm getting this failure on tests/ghci/should_run/ghcirun002:

<interactive>: internal error: ASSERTION FAILED: file rts/Interpreter.c, line 778

    (GHC version 7.9.20141029 for x86_64_unknown_linux)

The ASSERTION failure means that I must have -DDEBUG in my RTS; I have no idea why. My validate.mk looks like this:

GhcStage1HcOpts += -ticky  -DDEBUG
GhcStage2HcOpts +=  -ticky
GhcLibHcOpts +=  -Wwarn -ticky
SplitObjs       = YES

That is mysterious but not the main point. Somehow we are getting a stack overflow in the interpreter.

So I added this line to Interpreter on line 772:

        debugBelch ( "Interpreter Sp=%p SpLim=%p headroom = %ld\n\n", Sp, SpLim, Sp-SpLim ) ;

Sure enough, when running test ghcirun002 on HEAD, I get this output

Interpreter Sp=0x7f42649d0228 SpLim=0x7f42649d00c0 headroom = 45
Interpreter Sp=0x7f42649d0228 SpLim=0x7f42649d00c0 headroom = 45
Interpreter Sp=0x7f42649d0228 SpLim=0x7f42649d00c0 headroom = 45
Interpreter Sp=0x7f42649d0238 SpLim=0x7f42649d00c0 headroom = 47
Interpreter Sp=0x7f42649d0228 SpLim=0x7f42649d00c0 headroom = 45
Interpreter Sp=0x7f42649d0228 SpLim=0x7f42649d00c0 headroom = 45
Interpreter Sp=0x7f42649d0228 SpLim=0x7f42649d00c0 headroom = 45
Interpreter Sp=0x7f42649d0228 SpLim=0x7f42649d00c0 headroom = 45
Interpreter Sp=0x7f42649d0228 SpLim=0x7f42649d00c0 headroom = 45
Interpreter Sp=0x7f42649d0210 SpLim=0x7f42649d00c0 headroom = 42
Interpreter Sp=0x7f4264b40230 SpLim=0x7f4264b400c0 headroom = 46
Interpreter Sp=0x7f42649e1230 SpLim=0x7f42649e10c0 headroom = 46
Interpreter Sp=0x7f42649d9230 SpLim=0x7f42649d90c0 headroom = 46
Interpreter Sp=0x7f4264182230 SpLim=0x7f42641820c0 headroom = 46
Interpreter Sp=0x7f426417a230 SpLim=0x7f426417a0c0 headroom = 46
Interpreter Sp=0x7f4264172230 SpLim=0x7f42641720c0 headroom = 46
Interpreter Sp=0x7f426416a230 SpLim=0x7f426416a0c0 headroom = 46
Interpreter Sp=0x7f4264162230 SpLim=0x7f42641620c0 headroom = 46
Interpreter Sp=0x7f426415a230 SpLim=0x7f426415a0c0 headroom = 46
Interpreter Sp=0x7f4264152230 SpLim=0x7f42641520c0 headroom = 46
Interpreter Sp=0x7f426414a230 SpLim=0x7f426414a0c0 headroom = 46
Interpreter Sp=0x7f4264142230 SpLim=0x7f42641420c0 headroom = 46
Interpreter Sp=0x7f426413a230 SpLim=0x7f426413a0c0 headroom = 46
Interpreter Sp=0x7f4264132230 SpLim=0x7f42641320c0 headroom = 46
Interpreter Sp=0x7f42649d0238 SpLim=0x7f42649d00c0 headroom = 47
Interpreter Sp=0x7f4264a1e238 SpLim=0x7f4264a1e0c0 headroom = 47
Interpreter Sp=0x7f4264a16238 SpLim=0x7f4264a160c0 headroom = 47
Interpreter Sp=0x7f4264a0e238 SpLim=0x7f4264a0e0c0 headroom = 47
Interpreter Sp=0x7f4264a06238 SpLim=0x7f4264a060c0 headroom = 47
Interpreter Sp=0x7f4257ff8238 SpLim=0x7f4257ff80c0 headroom = 47
Interpreter Sp=0x7f4257ff0238 SpLim=0x7f4257ff00c0 headroom = 47
Interpreter Sp=0x7f4257fe8238 SpLim=0x7f4257fe80c0 headroom = 47
Interpreter Sp=0x7f4257fe0238 SpLim=0x7f4257fe00c0 headroom = 47
Interpreter Sp=0x7f4257fd8238 SpLim=0x7f4257fd80c0 headroom = 47
Interpreter Sp=0x7f4257fd0238 SpLim=0x7f4257fd00c0 headroom = 47
Interpreter Sp=0x7f4257fc8238 SpLim=0x7f4257fc80c0 headroom = 47
Interpreter Sp=0x7f4257fc0238 SpLim=0x7f4257fc00c0 headroom = 47
Interpreter Sp=0x7f4257fb8238 SpLim=0x7f4257fb80c0 headroom = 47
Interpreter Sp=0x7f4257fb0238 SpLim=0x7f4257fb00c0 headroom = 47
Interpreter Sp=0x7f42641f8238 SpLim=0x7f42641f80c0 headroom = 47
Interpreter Sp=0x7f42641f0238 SpLim=0x7f42641f00c0 headroom = 47
Interpreter Sp=0x7f42644f8238 SpLim=0x7f42644f80c0 headroom = 47
Interpreter Sp=0x7f42644ef238 SpLim=0x7f42644ef0c0 headroom = 47
Interpreter Sp=0x7f42644e7238 SpLim=0x7f42644e70c0 headroom = 47
Interpreter Sp=0x7f42644de238 SpLim=0x7f42644de0c0 headroom = 47
Interpreter Sp=0x7f42644d6238 SpLim=0x7f42644d60c0 headroom = 47
Interpreter Sp=0x7f42644ce238 SpLim=0x7f42644ce0c0 headroom = 47
Interpreter Sp=0x7f42644c5238 SpLim=0x7f42644c50c0 headroom = 47
Interpreter Sp=0x7f42644bd238 SpLim=0x7f42644bd0c0 headroom = 47
Interpreter Sp=0x7f42644b4238 SpLim=0x7f42644b40c0 headroom = 47
Interpreter Sp=0x7f42644ac238 SpLim=0x7f42644ac0c0 headroom = 47
Interpreter Sp=0x7f42644a4238 SpLim=0x7f42644a40c0 headroom = 47
Interpreter Sp=0x7f426449b238 SpLim=0x7f426449b0c0 headroom = 47
Interpreter Sp=0x7f4264493238 SpLim=0x7f42644930c0 headroom = 47
Interpreter Sp=0x7f426448a238 SpLim=0x7f426448a0c0 headroom = 47
Interpreter Sp=0x7f4264482238 SpLim=0x7f42644820c0 headroom = 47
Interpreter Sp=0x7f426447a238 SpLim=0x7f426447a0c0 headroom = 47
Interpreter Sp=0x7f426454e238 SpLim=0x7f426454e0c0 headroom = 47
Interpreter Sp=0x7f42641e8238 SpLim=0x7f42641e80c0 headroom = 47
Interpreter Sp=0x7f426417c238 SpLim=0x7f426417c0c0 headroom = 47
Interpreter Sp=0x7f4264174238 SpLim=0x7f42641740c0 headroom = 47
Interpreter Sp=0x7f426416c238 SpLim=0x7f426416c0c0 headroom = 47
Interpreter Sp=0x7f4264164238 SpLim=0x7f42641640c0 headroom = 47
Interpreter Sp=0x7f426415c238 SpLim=0x7f426415c0c0 headroom = 47
Interpreter Sp=0x7f4264154238 SpLim=0x7f42641540c0 headroom = 47
Interpreter Sp=0x7f426414c238 SpLim=0x7f426414c0c0 headroom = 47
Interpreter Sp=0x7f42643e0238 SpLim=0x7f42643e00c0 headroom = 47
Interpreter Sp=0x7f42643d8238 SpLim=0x7f42643d80c0 headroom = 47
Interpreter Sp=0x7f42643d0238 SpLim=0x7f42643d00c0 headroom = 47
Interpreter Sp=0x7f42643c8238 SpLim=0x7f42643c80c0 headroom = 47
Interpreter Sp=0x7f42643c0238 SpLim=0x7f42643c00c0 headroom = 47
Interpreter Sp=0x7f42643b8238 SpLim=0x7f42643b80c0 headroom = 47
Interpreter Sp=0x7f42643e0238 SpLim=0x7f42643e00c0 headroom = 47
Interpreter Sp=0x7f4264154138 SpLim=0x7f42641540c0 headroom = 15
Interpreter Sp=0x7f42641541d0 SpLim=0x7f42641540c0 headroom = 34
Interpreter Sp=0x7f426415c230 SpLim=0x7f426415c0c0 headroom = 46
Interpreter Sp=0x7f4264164130 SpLim=0x7f42641640c0 headroom = 14
Interpreter Sp=0x7f42641641c8 SpLim=0x7f42641640c0 headroom = 33
Interpreter Sp=0x7f426447a0e0 SpLim=0x7f426447a0c0 headroom = 4
Interpreter Sp=0x7f426447a178 SpLim=0x7f426447a0c0 headroom = 23
Interpreter Sp=0x7f426447a210 SpLim=0x7f426447a0c0 headroom = 42
Interpreter Sp=0x7f4264482138 SpLim=0x7f42644820c0 headroom = 15
Interpreter Sp=0x7f42644821d0 SpLim=0x7f42644820c0 headroom = 34
Interpreter Sp=0x7f426448a228 SpLim=0x7f426448a0c0 headroom = 45
Interpreter Sp=0x7f4264493238 SpLim=0x7f42644930c0 headroom = 47
Interpreter Sp=0x7f426449b130 SpLim=0x7f426449b0c0 headroom = 14
Interpreter Sp=0x7f426449b1c8 SpLim=0x7f426449b0c0 headroom = 33
Interpreter Sp=0x7f42644ac0d0 SpLim=0x7f42644ac0c0 headroom = 2
Interpreter Sp=0x7f42644ac168 SpLim=0x7f42644ac0c0 headroom = 21
Interpreter Sp=0x7f42644ac200 SpLim=0x7f42644ac0c0 headroom = 40
Interpreter Sp=0x7f42644b4230 SpLim=0x7f42644b40c0 headroom = 46
Interpreter Sp=0x7f42644bd108 SpLim=0x7f42644bd0c0 headroom = 9
Interpreter Sp=0x7f42644bd1a0 SpLim=0x7f42644bd0c0 headroom = 28
Interpreter Sp=0x7f42644bd238 SpLim=0x7f42644bd0c0 headroom = 47
Interpreter Sp=0x7f42644ce140 SpLim=0x7f42644ce0c0 headroom = 16
Interpreter Sp=0x7f42644ce1d8 SpLim=0x7f42644ce0c0 headroom = 35
Interpreter Sp=0x7f42644d6218 SpLim=0x7f42644d60c0 headroom = 43
Interpreter Sp=0x7f42644de0e0 SpLim=0x7f42644de0c0 headroom = 4
Interpreter Sp=0x7f42644de178 SpLim=0x7f42644de0c0 headroom = 23
Interpreter Sp=0x7f42644de210 SpLim=0x7f42644de0c0 headroom = 42
Interpreter Sp=0x7f42644e70c0 SpLim=0x7f42644e70c0 headroom = 0
Interpreter Sp=0x7f42644e7158 SpLim=0x7f42644e70c0 headroom = 19
Interpreter Sp=0x7f42644e71f0 SpLim=0x7f42644e70c0 headroom = 38
Interpreter Sp=0x7f42644ef230 SpLim=0x7f42644ef0c0 headroom = 46
Interpreter Sp=0x7f42644f8190 SpLim=0x7f42644f80c0 headroom = 26
Interpreter Sp=0x7f42644f8228 SpLim=0x7f42644f80c0 headroom = 45
Interpreter Sp=0x7f42641f00d8 SpLim=0x7f42641f00c0 headroom = 3
Interpreter Sp=0x7f42641f0170 SpLim=0x7f42641f00c0 headroom = 22
Interpreter Sp=0x7f42641f0208 SpLim=0x7f42641f00c0 headroom = 41
Interpreter Sp=0x7f4257fb8210 SpLim=0x7f4257fb80c0 headroom = 42
Interpreter Sp=0x7f4257fb80f0 SpLim=0x7f4257fb80c0 headroom = 6
Interpreter Sp=0x7f4257fb8188 SpLim=0x7f4257fb80c0 headroom = 25
Interpreter Sp=0x7f4257fb8220 SpLim=0x7f4257fb80c0 headroom = 44
Interpreter Sp=0x7f4257fc00d0 SpLim=0x7f4257fc00c0 headroom = 2
Interpreter Sp=0x7f4257fc0168 SpLim=0x7f4257fc00c0 headroom = 21
Interpreter Sp=0x7f4257fc0200 SpLim=0x7f4257fc00c0 headroom = 40
Interpreter Sp=0x7f4257fc80b0 SpLim=0x7f4257fc80c0 headroom = -2    <---- NB
Interpreter Sp=0x7f4257fc8148 SpLim=0x7f4257fc80c0 headroom = 17
Interpreter Sp=0x7f4257fc81e0 SpLim=0x7f4257fc80c0 headroom = 36
Interpreter Sp=0x7f4257fd0228 SpLim=0x7f4257fd00c0 headroom = 45
Interpreter Sp=0x7f4257fe0228 SpLim=0x7f4257fe00c0 headroom = 45
Interpreter Sp=0x7f4257fe8140 SpLim=0x7f4257fe80c0 headroom = 16
Interpreter Sp=0x7f4257fe81d8 SpLim=0x7f4257fe80c0 headroom = 35
Interpreter Sp=0x7f4257ff0120 SpLim=0x7f4257ff00c0 headroom = 12
Interpreter Sp=0x7f4257ff01b8 SpLim=0x7f4257ff00c0 headroom = 31
Interpreter Sp=0x7f4257ff8100 SpLim=0x7f4257ff80c0 headroom = 8
Interpreter Sp=0x7f4257ff8198 SpLim=0x7f4257ff80c0 headroom = 27
Interpreter Sp=0x7f4257ff8230 SpLim=0x7f4257ff80c0 headroom = 46
Interpreter Sp=0x7f4264a060e0 SpLim=0x7f4264a060c0 headroom = 4
Interpreter Sp=0x7f4264a06178 SpLim=0x7f4264a060c0 headroom = 23
Interpreter Sp=0x7f4264a06210 SpLim=0x7f4264a060c0 headroom = 42
Interpreter Sp=0x7f4264a0e0c0 SpLim=0x7f4264a0e0c0 headroom = 0
Interpreter Sp=0x7f4264a0e158 SpLim=0x7f4264a0e0c0 headroom = 19
Interpreter Sp=0x7f4264a0e1f0 SpLim=0x7f4264a0e0c0 headroom = 38
Interpreter Sp=0x7f4264a16138 SpLim=0x7f4264a160c0 headroom = 15
Interpreter Sp=0x7f4264a161d0 SpLim=0x7f4264a160c0 headroom = 34
Interpreter Sp=0x7f4264a1e118 SpLim=0x7f4264a1e0c0 headroom = 11

So yes, we get into a situation in which we have negative headroom. Presumably if the ASSERT is off, we simply don't notice. But it's clearly wrong.

Trac metadata
Trac field Value
Version 7.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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