32位windows下可以运行的程序在64位linux下报错
filt.c在32位windows code:blocks 10.05下运行无任何异样。传到64位linux下,gcc -Wall filt.c -o main编译无任何错误;程序可以跑出所有结果,
和
windows下一样。
但是运行到free语句时报错:
typedef struct CCDS_ {
long int start[15000], end[15000];
} CCDS;
main() {
CCDS *ccds[25];
for(i=1; i<25; i++) {
if((ccds[i]=(CCDS *)malloc(sizeof(CCDS))) == NULL) {
printf("malloc ccds failed");
exit(1);
}
}
.....
for(i=1; i<25; i++) {
free(ccds[i]);
ccds[i] = NULL;
}
.....
}
*** stack smashing detected ***: ./main terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x37)[0x7fac495431a7]
/lib/libc.so.6(__fortify_fail+0x0)[0x7fac49543170]
./main[0x400fb7]
/lib/libc.so.6(__libc_start_main+0xfd)[0x7fac49462c4d]
./main[0x400909]
======= Memory map: ========
00400000-00402000 r-xp 00000000 08:02 114164048
/home/cn2/pxd/Tibtan_BGI_calling/main
00601000-00602000 r--p 00001000 08:02 114164048
/home/cn2/pxd/Tibtan_BGI_calling/main
00602000-00603000 rw-p 00002000 08:02 114164048
/home/cn2/pxd/Tibtan_BGI_calling/main
020a8000-020c9000 rw-p 00000000 00:00 0
[heap]
7fac4922d000-7fac49243000 r-xp 00000000 08:02 7995471
/lib/libgcc_s.so.1
7fac49243000-7fac49442000 ---p 00016000 08:02 7995471
/lib/libgcc_s.so.1
7fac49442000-7fac49443000 r--p 00015000 08:02 7995471
/lib/libgcc_s.so.1
7fac49443000-7fac49444000 rw-p 00016000 08:02 7995471
/lib/libgcc_s.so.1
7fac49444000-7fac495bc000 r-xp 00000000 08:02 7995437
/lib/libc-2.11.1.so
7fac495bc000-7fac497bc000 ---p 00178000 08:02 7995437
/lib/libc-2.11.1.so
7fac497bc000-7fac497c0000 r--p 00178000 08:02 7995437
/lib/libc-2.11.1.so
7fac497c0000-7fac497c1000 rw-p 0017c000 08:02 7995437
/lib/libc-2.11.1.so
7fac497c1000-7fac497c6000 rw-p 00000000 00:00 0
7fac497c6000-7fac497e6000 r-xp 00000000 08:02 7995413
/lib/ld-2.11.1.so
7fac499d2000-7fac499d5000 rw-p 00000000 00:00 0
7fac499e1000-7fac499e5000 rw-p 00000000 00:00 0
7fac499e5000-7fac499e6000 r--p 0001f000 08:02 7995413
/lib/ld-2.11.1.so
7fac499e6000-7fac499e7000 rw-p 00020000 08:02 7995413
/lib/ld-2.11.1.so
7fac499e7000-7fac499e8000 rw-p 00000000 00:00 0
7fff53918000-7fff5392d000 rw-p 00000000 00:00 0
[stack]
7fff539ca000-7fff539cb000 r-xp 00000000 00:00 0
[vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0
[vsyscall]
已放弃