在Fortran2003程序中,我想创建一个派生类型,该派生类型包括具有asynchronous
属性的可分配数组:
module async_in_type
type async_array
integer, dimension(:), allocatable, asynchronous :: a
end type async_array
end module async_in_type
当我尝试使用GCC编译以上代码时,出现以下错误消息:
$ gfortran -c -Wall -Wextra async_in_type.F90
GNU Fortran (GCC) 4.10.0 20140718 (experimental)
async_in_type.F90:3.52:
integer, dimension(:), allocatable, asynchronous :: a
1
Error: Attribute at (1) is not allowed in a TYPE definition
使用NAG Fortran时,消息类似:
$ nagfor -c async_in_type.F90
NAG Fortran Compiler Release 6.0(Hibiya)
Product NPL6A60NA for x86-64 Linux
Error: async_in_type.F90, line 3: Syntax error
detected at ,@ASYNCHRONOUS
[NAG Fortran Compiler pass 1 error termination, 1 error]
这种限制的原因是什么?是否有可能克服这一限制?
编译器消息准确无误,让我重复一下:
Error: Attribute at (1) is not allowed in a TYPE definition
因此,标准完全不允许这样做。
您必须将asynchronous
属性放入类型的变量async_in_type
。
type(async_in_type), asynchronous :: x
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句