[GHC] #3117: via C compilation of module importing log1p from
<math.h> fails.
GHC
trac at galois.com
Mon Mar 23 14:34:54 EDT 2009
#3117: via C compilation of module importing log1p from <math.h> fails.
-----------------------------+----------------------------------------------
Reporter: int-e | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 6.10.1 | Severity: normal
Keywords: | Testcase:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
-----------------------------+----------------------------------------------
This module fails to compile:
{{{
{-# LANGUAGE ForeignFunctionInterface #-}
{-# OPTIONS_GHC -fvia-C #-}
foreign import ccall unsafe "math.h log1p" log1p :: Double -> Double
main = print (log1p 1)
}}}
With errors like these:
{{{
/tmp/ghc25313_0/ghc25313_0.hc: In function 'svD_entry':
/tmp/ghc25313_0/ghc25313_0.hc:66:0:
error: 'log1p' redeclared as different kind of symbol
/usr/include/bits/mathcalls.h:132:0:
error: previous declaration of 'log1p' was here
}}}
This is affecting the {{{logfloat}}} package on hackage.
The reason is that {{{ghc}}} doesn't generate proper prototypes for
foreign imports, but that's probably ok as long as no conflicting
prototypes are defined for the same function.
To accomplish this, {{{ghc}}} treats functions from {{{math.h}}}
specially, but a number of these functions like {{{log1p}}} are not
recognized. See {{{compiler/cmm/CLabel.hs}}}.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3117>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list