- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
FYI: The following code generates an internal compiler error (latest version of the compiler: 2011 Update 11), but only when I use the /standard-semantics flag. It is caused when passing an allocatable array as the first argument of the MOD function (see test2 subroutine), while the second argument is a scalar. The static array version (test1) compiles fine.
[fortran]program test implicit none call test1() call test2() contains !**************************** subroutine test1 !this one compiles file !**************************** implicit none integer,dimension(2) :: a, b a = 4 b = mod(a, 2) write(*,*) b !**************************** end subroutine test1 !**************************** !**************************** subroutine test2 !this one causes an internal compiler error !**************************** implicit none integer,dimension(:),allocatable :: a, b allocate(a(2)) allocate(b(2)) a = 4 b = mod(a, 2) write(*,*) b !**************************** end subroutine test2 !**************************** end program test [/fortran]
コピーされたリンク
3 返答(返信)
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
It looks like the problem was corrected in the 13.0 beta compiler, so should be OK in the next release. standard-semantics changes the list-directed formatting; maybe that's what you intended.
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
It's the /assume:realloc_lhs part of /standard-semantics that is the problem here. It isn't specifically the MOD but rather the assignment of the MOD expression to the allocatable array. Tim is right that this is fixed in the 13.0 compiler, due out in a couple of weeks. You could add /assume:norealloc_lhs to work around this for now.
