[U-Boot-Users] Arm-linux-gcc malloc get failure while arm-elf-gcc ok

Rui.Zhou at nokia.com Rui.Zhou at nokia.com
Sat Jan 27 05:11:27 CET 2007


 hi there

I wonder if I am the first one to get this problem

In common\lists.c

Handle NewHandle (unsigned int numBytes)
{
	void *memPtr;
	HandleRecord *hanPtr;

	memPtr = calloc (numBytes, 1);
	hanPtr = (HandleRecord *) calloc (sizeof (HandleRecord), 1);

Debug("memPtr:%d hanPtr:%d\n",memPtr ,hanPtr ); //arm-linux-gcc get 0
for both of the Ptr while arm-elf-gcc can malloc successfully

	if (hanPtr && (memPtr || numBytes == 0)) {
		hanPtr->ptr = memPtr;
		hanPtr->size = numBytes;
		return (Handle) hanPtr;
	} else {
		free (memPtr);
		free (hanPtr);
		return NULL;
	}

}

Arm-elf-gcc is 3.4.0
Arm-linux-gcc is 3.3.2 (heard there are most problems in this version??)

Regards
Zhou rui
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20070127/eaa7d44c/attachment.htm 


More information about the U-Boot mailing list