Gfortran 写入输出时返回错误

问题描述

我最近从 gfortran v5.1 to v8.2.0. 更新,我尝试在配备 Intel Core i5 的 iMac 中运行名为 test1.f90 的简单程序


program test1

  write(6,*) '1'

  open(8,file='gamma.out')

  write(6,*) '2'

end program test1

我使用

编译它
gfortran test1.f90 -o test1.x

运行它时我得到输出


 1

At line 3 of file test1.f90 (unit = 8,file = '')

Fortran runtime error: Bad address

然后我尝试了程序test2.f90:


程序测试2

write(6,*) '1'

  x=1.0

  write(6,*) '2'

  write(6,*) x

  write(6,*) '3'

  write(6,'(f10.5)') x

  write(6,*) '4'

end program test2

我现在得到的输出是:


1

2

1.00000000

3

程序收到信号SIGSEGV:分段错误 - 无效的内存引用。

此错误的回溯:

#0 0x104c622d2

#1 0x104c62a8e

#2 0x7fff6f4c1b5c

#3 0x104d222a0

#4 0x104d31197

#5 0x104c5bdf4

#6 0x104c5bebc

分段错误


操作系统为 MOJAVE 10.14.6。

gfortran --version 产生 8.2.0

我使用 https://github.com/fxcoudert/gfortran-for-macOS/releases/tag/8.2 提供的 .dmg 安装程序安装了这个新版本的 gfortran

有什么可能出错的想法吗? 谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)