size_t for LLP64 pointers

This commit is contained in:
edoapra 2022-11-06 22:26:33 -08:00
parent fd74cdaa93
commit 3969c5c9c5
No known key found for this signature in database
GPG key ID: 48E12DA1EDE9E1B0
2 changed files with 38 additions and 0 deletions

31
src/tools/gamalloc_patch.sh Executable file
View file

@ -0,0 +1,31 @@
#!/usr/bin/env bash
rm -f gamalloc.patch
cat > gamlloc.patch <<EOF
--- $1/global/src/ga_malloc.c
+++ $1/global/src/ga_malloc.c
@@ -28,7 +28,7 @@
void* ga_malloc(Integer nelem, int type, char *name)
{
void *ptr;
- unsigned long addr;
+ size_t addr;
Integer handle, adjust=0, bytes, item_size=GAsizeofM(pnga_type_f2c(type));
Integer extra;
@@ -45,11 +45,11 @@
if(ga_usesMA) { /* Uses Memory Allocator (MA) */
if(MA_push_stack(type,nelem,name,&handle)) MA_get_pointer(handle,&ptr);
else pnga_error("ga_malloc: MA_push_stack failed",0);
- addr = (unsigned long)ptr;
+ addr = (size_t)ptr;
}
else { /* else, using external memory allocator */
bytes = nelem*item_size;
- addr = (unsigned long)(*ga_ext_alloc)(
+ addr = (size_t)(*ga_ext_alloc)(
(size_t)bytes, (int)item_size, name);
}
EOF
patch -p0 -s -N < gamalloc.patch
echo gamalloc.patch applied

View file

@ -200,6 +200,13 @@ if [[ -z "${CC}" ]]; then
CC=cc
fi
GOTMINGW64=` $CC -dM -E - </dev/null 2> /dev/null |grep MINGW64|cut -c21 `
if [[ -d "ga-5.8.2" ]]; then
if [[ ! -f "ga-5.8.2/patched581" ]]; then
./gamalloc_patch.sh $GA_DIR
echo patched
touch ga-5.8.2/patched581
fi
fi
#if [ ! -z "$GOTMINGW64" ]
#then
#echo "CC" $CC