logo       

-package base and External Core files: msg#00014

lang.haskell.glasgow.bugs

Subject: -package base and External Core files

It appears that certain External Core programs will not be compiled correctly
unless the -package base flag is explicitly included on the command line.
Here's a transcript that should demonstrate what I mean (the program being
compiled is the imaginary/x2n1 nofib benchmark):

$ ghc -fext-core -fno-code Main.hs
$ ghc -o Good -no-recomp -O1 -package base Main.hcr
$ ./Good 10
10
$ ghc -o Bad -no-recomp -O1 Main.hcr
/tmp/ghc14001.hc: In function `Main_zdwmkPolar_entry':
/tmp/ghc14001.hc:56: warning: implicit declaration of function `sin'
/tmp/ghc14001.hc:62: warning: implicit declaration of function `cos'
$ ./Bad 10
-269653970229347386159395778618353710042696546841345985910145121736599013708251444699062715983611304031680170819807090036488184653221624933739271145959211186566651840137298227914453329401869141179179624428127508653257226023513694322210869665811240855745025766026879447359920868907719574457253034494436336205824
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 5.05

The -O1 is relevant -- with no optimization, it compiles correctly in either
case. It seems that without the explicit "-package base", GHC generates an
.hc file that is missing the #include directive for HsBase.h, resulting (in
this case) in the wrong definitions of sin and cos getting used, resulting in
incorrect output. I don't see anything in the documentation for External Core
that says you have to explicitly specify the base package, so I'm guessing it's
a bug.

--
Kirsten Chevalier * krc@xxxxxxxxxxxxxxxxxxx * Often in error, never in doubt


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise