- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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]
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, we'll take a look.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page