I was assigned to a pointer and it was free immediately, but sigsegv occurs depending on some devices and xlc options.
xlC_r -o cc.o c.c -lhm has sigsegv occurred, but xlC_r -o cc.o c.c works.
( lhm option is linking libhm.a libhu.a. )
( malloc and free works. Only posix_memalign and free sigsegv occurred. )
Source code:
#include<stdlib.h>
#include<stdio.h>
int main()
{
void * sPtr = NULL;
size_t sAlign = 8388608;
size_t sSize = 8388648;
int sRet = 0;
sRet = posix_memalign(&sPtr, sAlign, sSize);
printf( "after malloc : %p return : %d\n", sPtr, sRet );
free(sPtr);
printf( "after free\n" );
return 0;
}
It works:
aix7.1 tl3 IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72) Version: 12.01.0000.0000
aix6.1 tl9 IBM XL C/C++ for AIX, V10.1 Version: 10.01.0000.0008
Result is:
after malloc : 22000000 return : 0
after free
but
aix6.1 tl3 IBM XL C/C++ for AIX, V10.1 Version: 10.01.0000.0008
aix5.3 tl9 IBM XL C/C++ for AIX, V10.1 Version: 10.01.0000.0000
aix5.3 tl1 C for AIX version 6.0.0.0
Version: 10.01.0000.0000
Result is
after malloc : 22000000 return : 0
Segmentation fault (core dumped)
% dbx cc.o core
Type 'help' for help.
[using memory image in core]
reading symbolic information ...
Segmentation fault in _ufree at 0xd3c0fcc4 ($t1)
0xd3c0fcc4 (_ufree+0x44) 80be0000 lwz r5,0x0(r30)
(dbx) where
_ufree(??) at 0xd3c0fcc4
cbase.free(??) at 0xd2b7c048
main(), line 16 in "c.c"
I have not solved this problem although I've been trying for over a week. I searched for a bug report from AIX, but I couldn't find one.
It is not possible to delete both posix_memalign and lhm option.
Do you know a workaround or how to solve it?