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,333
    • Issues 4,333
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 370
    • Merge Requests 370
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #14829

Closed
Open
Opened Feb 20, 2018 by ehubinette@trac-ehubinette

Linking error with ANN pragma

There seems to be an issue with the ANN pragma, with fatal compilation errors.

To reproduce, setup two modules as such:

module Test where

import Weights (Weight(..))

{-# ANN mainTest (Weight 2) #-}
mainTest :: IO ()
mainTest = return ()
{-# LANGUAGE DeriveDataTypeable #-}
module Weights (Weight(..)) where

import Data.Data (Data(..))

newtype Weight = Weight Integer deriving Data

Compiling with GHC version 8.2.2 yields:

λ ghc Test.hs
[1 of 2] Compiling Weights          ( Weights.hs, Weights.o )
[2 of 2] Compiling Test             ( Test.hs, Test.o )
Test.hs:5:1: fatal:
    cannot find object file ‘./Weights.dyn_o’
    while linking an interpreted expression

The issue disappears with -dynamic or -dynamic-too:

λ ghc -dynamic Test.hs
[1 of 2] Compiling Weights          ( Weights.hs, Weights.o )
[2 of 2] Compiling Test             ( Test.hs, Test.o )

Issue persist in HEAD, GHC version 8.5.20180219, but again disappears with -dynamic-too or -dynamic:

λ ../../ghc/inplace/bin/ghc-stage2 -dynamic-too Test.hs
[1 of 2] Compiling Weights          ( Weights.hs, Weights.o )
[2 of 2] Compiling Test             ( Test.hs, Test.o )

Remove the ANN pragma, and the compiler behaves just fine with both GHC versions. Please tell me if I can provide more information. Cheers.

Edited Mar 10, 2019 by ehubinette
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#14829