Fortran 编译执行中不需要的回溯信息

Non-desired backtrace info in fortran-compiled execution

我正在开发一个 Fortran 代码(标准 2003),我必须在其中控制所有非名义出口。

当执行不带参数的代码时(它需要一些参数),我收到了预期的退出代码 + 一些未询问的回溯信息,如下所示:

 ./test_1 
 Error    | Wrong number of inputs in test_1
 STOP 128

 Backtrace for this error:
 #0  0x0000003b9b0ac584 in wait () from /lib64/libc.so.6
 #1  0x00007ff41d8ff00d in ?? () from /usr//lib64/libgfortran.so.3
 #2  0x00007ff41d90082e in ?? () from /usr//lib64/libgfortran.so.3
 #3  0x00007ff41d90112f in _gfortran_stop_numeric () from usr//lib64/libgfortran.so.3
 #4  0x000000000041f7d4 in _gfortran_stop_numeric_f08 ()
 #5  0x000000000041b680 in MAIN__ ()
 #6  0x000000000041f74d in main ()

奇怪的是,我的优化编译(我认为)没有任何标志来调用回溯。

gfortran -Wall -Wextra -Wuninitialized -Wno-maybe-uninitialized -O2 -finit-local-zero -I/opt/cots/netcdf_4.2_gfortran/include  -L/usr//lib64 -Wl,-rpath,/usr//lib64 -L/opt/cots/netcdf_4.2_gfortran/lib -Wl,-rpath,/opt/cots/netcdf_4.2_gfortran/lib  -o test_1 test_1.o  -lnetcdff -lnetcdf -lz -lm 

我在调试模式下有它。但我使用的是优化的可执行文件...

有人知道我怎样才能去掉回溯信息吗?

我假设它与代码无关,因为它出现在止损单之后。

非常感谢!

对于 GCC 版本,您可以使用 -fno-backtrace,其中 -fbacktrace 是默认值。