error#8093 ,error#6511,编写代码遇到这两个错误请问怎么解决
本帖最后由 菜鸟萌新 于 2018-11-10 14:49 编辑描述错误#8093:DO主体内的do变量不应出现在变量定义上下文中。
描述错误#6511:此DO变量已在同一嵌套结构中用作外部DO变量。
以上描述是用谷歌翻译,如有错误请指正。
截图中代码是用来冒泡排序。
个人理解是双循环中的变量I用了两次,出现在下一个do循环中,但就fortran语法来说这是允许的,不知道如何解决。也有可能是我对错误的描述理解出现偏差
本帖最后由 菜鸟萌新 于 2018-11-10 17:11 编辑
https://software.intel.com/en-us ... c-os-x/topic/559950
The interesting (to me, anyway) part of this question is that the do-variable in an io-implied-do does NOT have "statement scope" the way a DATA implied-do or array constructor implied-do variable do.With statement scope, the implied-do variable is a new, different variable that inherits only the type of any outer-scope variable (but that type must be integer.)The "i" in the I/O implied DO is the same variable as the line 1 DO control variable and ifort is absolutely correct in complaining about this., pgf90 could support this as an extension, but would need to have the ability to diagnose it (perhaps through a standards checking switch), or else risk being a nonconforming implementation.
The other interesting part is that we do, sort-of, allow changing DO variables, as an extension, but you have to do it by passing the variable to a procedure which then changes it. ifort recognizes the possibility and generates an explicit test rather than a loop count if it sees this.
这个问题的有趣(对我来说,无论如何)部分是io声明的do中的do的变量没有DATA声明的方式或者数组构造函数声明-do变量的方式。 对于语句范围,声明do变量是一个新的,不同的变量,它只继承任何外部作用域变量的类型(但该类型必须是整数。)I / O暗示DO中的“i”是相同的变量 作为第1行DO控制变量和ifort在抱怨这一点时绝对正确。,pgf90可以支持这作为扩展,但是需要能够诊断它(可能通过标准检查开关),否则冒险成为 不合格的实施。
另一个有趣的部分是我们这样做,排序,允许更改DO变量,作为扩展,但你必须通过将变量传递给一个程序然后更改它来完成它。 如果它看到这个,ifort会识别出这种可能性并生成一个显式测试而不是一个循环计数。
https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/topic/559950
The interesting (to me, anyway) part of this question is that the do-variable in an io-implied-do does NOT have "statement scope" the way a DATA implied-do or array constructor implied-do variable do.With statement scope, the implied-do variable is a new, different variable that inherits only the type of any outer-scope variable (but that type must be integer.)The "i" in the I/O implied DO is the same variable as the line 1 DO control variable and ifort is absolutely correct in complaining about this., pgf90 could support this as an extension, but would need to have the ability to diagnose it (perhaps through a standards checking switch), or else risk being a nonconforming implementation.
The other interesting part is that we do, sort-of, allow changing DO variables, as an extension, but you have to do it by passing the variable to a procedure which then changes it. ifort recognizes the possibility and generates an explicit test rather than a loop count if it sees this.
这个问题的有趣(对我来说,无论如何)部分是io-implied-do中的do-variable没有DATA隐含的方式或者数组构造函数暗示-do变量的方式。 对于语句范围,implied-do变量是一个新的,不同的变量,它只继承任何外部作用域变量的类型(但该类型必须是整数。)I / O暗示DO中的“i”是相同的变量 作为第1行DO控制变量和ifort在抱怨这一点时绝对正确。,pgf90可以支持这作为扩展,但是需要能够诊断它(可能通过标准检查开关),否则冒险成为 不合格的实施。
另一个有趣的部分是我们这样做,排序,允许更改DO变量,作为扩展,但你必须通过将变量传递给一个程序然后更改它来完成它。 如果它看到这个,ifort会识别出这种可能性并生成一个显式测试而不是一个循环计数。 本帖最后由 菜鸟萌新 于 2018-11-11 10:18 编辑
已找到问题, 是另外一个模块do循环没有加终结语结束循环,i 的值被篡改,因为我的循环语句用的是i 作为变量,对所有的循环语句都造成了干扰
页:
[1]