zullil wrote:
But does it work if you try to make a 64-bit build?
Good catch. With a 64-bit build I get the same error. The problem is that the 'size' parameter of AlignedMalloc and AlignedRemalloc has type 'int'; it should be a 'size_t'. With that change it works correctly for me. Here's a patch of the changes I made:
diff -rup crafty-23.1/chess.h crafty-23.1-fixed/chess.h
--- crafty-23.1/chess.h 2009-11-18 12:43:12.000000000 -0600
+++ crafty-23.1-fixed/chess.h 2009-11-20 20:15:20.000000000 -0600
@@ -23,7 +23,6 @@
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
-#include <malloc.h>
#include <string.h>
#if !defined(TYPES_INCLUDED)
# include "lock.h"
@@ -375,8 +374,8 @@ int CDECL MSB(BITBOARD);
int CDECL LSB(BITBOARD);
# endif
# endif
-void AlignedMalloc(void **, int, int);
-void AlignedRemalloc(void **, int, int);
+void AlignedMalloc(void **, int, size_t);
+void AlignedRemalloc(void **, int, size_t);
void Analyze(void);
void Annotate(void);
void AnnotateHeaderHTML(char *, FILE *);
Only in crafty-23.1-fixed/: game.001
Only in crafty-23.1-fixed/: log.001
diff -rup crafty-23.1/utility.c crafty-23.1-fixed/utility.c
--- crafty-23.1/utility.c 2009-11-18 12:43:12.000000000 -0600
+++ crafty-23.1-fixed/utility.c 2009-11-20 20:14:56.000000000 -0600
@@ -67,7 +67,7 @@
*******************************************************************************
*/
-void AlignedMalloc(void **pointer, int alignment, int size) {
+void AlignedMalloc(void **pointer, int alignment, size_t size) {
segments[nsegments][0] = malloc(size + alignment - 1);
segments[nsegments][1] =
(void *) (((long) segments[nsegments][0] + alignment -
@@ -85,7 +85,7 @@ void AlignedMalloc(void **pointer, int a
*******************************************************************************
*/
-void AlignedRemalloc(void **pointer, int alignment, int size) {
+void AlignedRemalloc(void **pointer, int alignment, size_t size) {
int i;
for (i = 0; i < nsegments; i++)
if (segments
[1] == *pointer)