Skip to content

GHC panics when linking with an archive and using an annotation

GHC panics when compiling code with an annotation and linking with an archive (a .a file). I think this is the same as #9438, but I have a really simple test case consisting of the following two files:

// add.c
int add2(int x, int y) { return x + y; }
-- app.hs
{-# ANN module () #-}

main :: IO ()
main = return ()

First I make an archive:

$ gcc -c add.c -o add.o
$ ar libadd.a add.o

And then the following fails:

$ ghc -ladd -L. app.hs
[1 of 1] Compiling Main             ( app.hs, app.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.2.2 for x86_64-apple-darwin):
	Loading archives not supported

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

make: *** [app] Error 1

The attached tar.gz has these source files and a Makefile to run the above. I've tested it on OS X 10.11 and Linux, both with GHC 8.2.2, and the behavior is the same.

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
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information