#5967: incompatible implicit declaration of function 'memcpy'
------------------------------+---------------------------------------------
Reporter: nomeata | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.4.1 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Other | Testcase:
Blockedby: | Blocking:
Related: |
------------------------------+---------------------------------------------
Comment(by nomeata):
Looking at the generated C code right now. The conflicting definitions of
memcpy are:
{{{
;EF_(memcpy);
{void * (*ghcFunPtr)(void *, void *, W_);
ghcFunPtr = ((void * (*)(void *, void *, W_))(W_)&memcpy);
_sbJq = (W_)ghcFunPtr((void *)_ccwP, (void *)_ccwO, _sbJk);;}
}}}
and
{{{
*((P_)_cgnM) = (W_)&stg_MUT_ARR_PTRS_DIRTY_info;
_cgnO = (_cgnP+12) + (_cgnQ << 0x2U);
_cgnN = _cgnK * 0x4U;
if ((W_)(_cgnP == _cgnM)) goto _cgnR;
memcpy((void *)(_cgnM+12), (void *)_cgnO, _cgnN);
}}}
Where _cd8l is of type {{{W_}}} and {{{EF_}}} is defined in
{{{includes/Stg.h}}} as:
{{{
#define EF_(f) extern StgFunPtr f(void)
}}}
with
{{{
typedef void *(*(*StgFunPtr)(void))(void);
}}}
It seems that there are two ways of calling the external function, one
with it having type StgFunPtr and coercing it before use, and one with
assuming it to have the type it has. If both are used in the same file,
things break. Maybe the first style comes from a standard FFI call, and
the second style somehow from “more internal” code, as it works with
MUT_ARR_PTRS? {{{doCopyMutableByteArrayOp}}} or a related function in
source:compiler/codeGen/StgCmmPrim.hs is a hot candidate, as they call
{{{emitMemcpyCall}}}.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5967#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs