Bug#440408: [x86,x64] tests argument instead of return value, fails to compile xmlrpc-c with optimization
"Nemui Ailin" <ailin.nemui@gmail.com> writes:
> Compiling xmlrpc-c CVS from <URL:http://xmlrpc-c.sourceforge.net/>
> results in a broken xmlrpc library that fails to allocate memory for the
> structs.
>
> We have this call to realloc in src/method.c
>
> static __inline__ void
> reallocProduct(void ** const blockP,
> unsigned int const factor1,
> unsigned int const factor2) {
>
> if (UINT_MAX / factor2 < factor1)
> *blockP = NULL;
> else
> *blockP = realloc(*blockP, factor1 * factor2);
> }
>
> #define REALLOCARRAY(arrayName, nElements) \
> reallocProduct((void **)&arrayName, nElements, sizeof(arrayName[0]))
>
> REALLOCARRAY(signatureP->argList, minArgCount);
> if (signatureP->argList == NULL) {
> // ...
Unfortunately, you did not send a complete test case, so this is hard
to tell, but it looks like an aliasing violation in your code.
"*blockP" accesses an lvalue of type "void*", while its actual type is
probably some other pointer type; that is not allowed.
Please test whether the problem goes away with -fno-strict-aliasing.
If not, please provide a complete test case.
--
Falk
Reply to: