福特兰语言。新的 gcc - “浮点读取期间的错误值”
我想在 Fortran 77 中使用一个非常旧的程序。但是新版本的 gcc 给我错误“Fortran 运行时错误:浮点读取期间的错误值”。 我需要将字符串读取到数组。过去是:
read(direc(2:ieq2-1),103) acent
103 format(3f12.7)
其中 (direc(2:ieq2-1)='(0.,0.,0.)' and ieq2-1=8 and acent=(0.0000000 0.0000000 0.0000000)。 我应该改变什么?
非常感谢您的回答!
新版本意味着:gcc 版本 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4); 声明:
acent(1)=0.0
acent(2)=0.0
acent(3)=0.0
character*100 direc
马克西姆
I would like to use a very old program in Fortran 77. But a new version of gcc gives me error “Fortran runtime error: Bad value during floating point read”.
I need to read string to array. In past it was:
read(direc(2:ieq2-1),103) acent
103 format(3f12.7)
Where (direc(2:ieq2-1)=’(0.,0.,0.)’ and ieq2-1=8 and acent=(0.0000000 0.0000000 0.0000000).
What should I change?
Thank you very much for your answers!
A new version means: gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4);
Declaration:
acent(1)=0.0
acent(2)=0.0
acent(3)=0.0
character*100 direc
Maxim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果 direc(2:ieq2-1) 是一个字符串,这将有意义,在这种情况下读取将是“内部 IO”,但字符串的内容应该是数字。没有任何括号。由于您使用字段宽度为 12 的格式,因此应将值间隔开以适合这些字段。使用列表定向(无格式)读取可能更容易:read(direc(2:ieq2-1),*) acent。直接音和重音如何表达?
This would make some sense if direc(2:ieq2-1) were a string, in which case the read would be "internal IO", but the contents of the string should be numeric. Without any parentheses. Since you are using a format with field widths of 12, the values should be spaced out to fit into those fields. It might be easier to use a list directed (format-free) read: read(direc(2:ieq2-1),*) acent. How are direct and acent declared?