主题:[讨论]关于gfortran添加优化参数的问题!求教!
我写了个子计算程序,给主程序调用。编译成可执行文件的时候,最开始我在网上找的参照,编译参数如下:
F90="gfortran"
CPP="gcc -E"
F90FLAGS="-DDEC_ALPHA"
CPPFLAGS="-DLINUX -DD_PRECISION"
LDFLAGS="-lm"
这样编译出来后可以执行,但是效率较低,我想优化一下,添加优化参数,例如-O3等,
我添加到 F90FLAGS="-O3 -DDEC_ALPHA",调用以后,我的程序竟然不能顺利执行了!
出现下面的错误信息:
*** glibc detected *** ./solver: free(): invalid pointer: 0x00007fff0a71d9b8 ***
======= Backtrace: =========
/lib64/libc.so.6[0x338d471ce2]
/lib64/libc.so.6(cfree+0x8c)[0x338d47590c]
/usr/lib64/libgfortran.so.1(_gfortran_deallocate+0x26)[0x2abefdf9f2a6]
./solver[0x443531]
./solver[0x444048]
./solver[0x48cd2b]
./solver[0x48f046]
./solver[0x48f0df]
./solver[0x4c459e]
/lib64/libc.so.6(__libc_start_main+0xf4)[0x338d41d974]
./solver[0x4012c9]
======= Memory map: ========
00400000-004d8000 r-xp 00000000 00:13 216753023 /home/study/nigel_case/a/try/solver
006d7000-006d9000 rw-p 000d7000 00:13 216753023 /home/study/nigel_case/a/try/solver
006d9000-006de000 rw-p 006d9000 00:00 0
1df72000-21703000 rw-p 1df72000 00:00 0 [heap]
338d000000-338d01c000 r-xp 00000000 08:02 7864613 /lib64/ld-2.5.so
338d21b000-338d21c000 r--p 0001b000 08:02 7864613 /lib64/ld-2.5.so
338d21c000-338d21d000 rw-p 0001c000 08:02 7864613 /lib64/ld-2.5.so
338d400000-338d54c000 r-xp 00000000 08:02 7864614 /lib64/libc-2.5.so
338d54c000-338d74c000 ---p 0014c000 08:02 7864614 /lib64/libc-2.5.so
338d74c000-338d750000 r--p 0014c000 08:02 7864614 /lib64/libc-2.5.so
338d750000-338d751000 rw-p 00150000 08:02 7864614 /lib64/libc-2.5.so
338d751000-338d756000 rw-p 338d751000 00:00 0
338dc00000-338dc82000 r-xp 00000000 08:02 7864622 /lib64/libm-2.5.so
338dc82000-338de81000 ---p 00082000 08:02 7864622 /lib64/libm-2.5.so
338de81000-338de82000 r--p 00081000 08:02 7864622 /lib64/libm-2.5.so
338de82000-338de83000 rw-p 00082000 08:02 7864622 /lib64/libm-2.5.so
339ce00000-339ce0d000 r-xp 00000000 08:02 7864624 /lib64/libgcc_s-4.1.2-20080825.so.1
339ce0d000-339d00d000 ---p 0000d000 08:02 7864624 /lib64/libgcc_s-4.1.2-20080825.so.1
339d00d000-339d00e000 rw-p 0000d000 08:02 7864624 /lib64/libgcc_s-4.1.2-20080825.so.1
2abefdf78000-2abefdf79000 rw-p 2abefdf78000 00:00 0
2abefdf8d000-2abefdf8e000 rw-p 2abefdf8d000 00:00 0
2abefdf8e000-2abefe024000 r-xp 00000000 08:02 32909712 /usr/lib64/libgfortran.so.1.0.0
2abefe024000-2abefe223000 ---p 00096000 08:02 32909712 /usr/lib64/libgfortran.so.1.0.0
2abefe223000-2abefe225000 rw-p 00095000 08:02 32909712 /usr/lib64/libgfortran.so.1.0.0
2abefe225000-2abefe227000 rw-p 2abefe225000 00:00 0
2abf00000000-2abf00021000 rw-p 2abf00000000 00:00 0
2abf00021000-2abf04000000 ---p 2abf00021000 00:00 0
7fff0a70b000-7fff0a720000 rw-p 7ffffffea000 00:00 0 [stack]
ffffffffff600000-ffffffffffe00000 ---p 00000000 00:00 0 [vdso]
Aborted
我的程序到底应该怎么添加?请指导!