via C compilation of module importing log1p from <math.h> fails.
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.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 6.10.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |