我被分配了一个指针,它立即免费,但 sigsegv 取决于某些设备和 xlc 选项。
xlC_r -o cc.o cc -lhm 发生了 sigsegv,但 xlC_r -o cc.o cc 有效。
( lhm 选项正在链接 libhm.a libhu.a。)
( malloc 和 free 作品。只有 posix_memalign 和 free sigsegv 发生。)
源代码:
#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;
}
有用:
aix7.1 tl3 IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72) 版本:12.01.0000.0000
aix6.1 tl9 IBM XL C/C++ for AIX, V10.1 版本:10.01.0000.0008
结果是:
after malloc : 22000000 return : 0
after free
但
aix6.1 tl3 IBM XL C/C++ for AIX,V10.1 版本:10.01.0000.0008
aix5.3 tl9 IBM XL C/C++ for AIX,V10.1 版本:10.01.0000.0000
aix5.3 tl1 C for AIX 版本 6.0。 0.0 版本:10.01.0000.0000
结果是
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"
尽管我已经尝试了一个多星期,但我还没有解决这个问题。我从 AIX 搜索了一份错误报告,但找不到。
无法同时删除 posix_memalign 和 lhm 选项。
您知道解决方法或如何解决它吗?