Skip to content

GitLab

  • Menu
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 4,968
    • Issues 4,968
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 474
    • Merge requests 474
  • 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 Compiler
  • GHCGHC
  • Issues
  • #14577
Closed
Open
Created Dec 13, 2017 by lazac@trac-lazac

Internal error when linker is initialized with -fexternal-interpreter set when compiling TH code with profiling

When using the GHC API with this minimal example, using the -fexternal-interpreter option, compiled with profiling enabled:

import GHC
import Control.Monad.IO.Class
import GHC.Paths ( libdir )
import DynFlags
import Linker

main = runGhc (Just libdir) $ do
        env <- getSession
        dflags <- getSessionDynFlags
        liftIO $ initDynLinker env
        setSessionDynFlags (setGeneralFlag' Opt_ExternalInterpreter dflags) 
        target <- guessTarget "A.hs" Nothing
        setTargets [target]
        load LoadAllTargets

Invoking the main executable:

testprof

While A.hs contains a TH splice:

{-# LANGUAGE TemplateHaskell #-}
module A where

$(return [])

The compiler crashes:

Access violation in generated code when writing 0000000000000024

Probably I'm misusing the API in this example, but the way it crashes is suspicious.

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