Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29273 Discussions

Internal compiler error with MOD statement and /standard-semantics

Jacob_Williams
New Contributor III
572 Views
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]

0 Kudos
3 Replies
Steven_L_Intel1
Employee
572 Views
Thanks, we'll take a look.
0 Kudos
TimP
Honored Contributor III
571 Views
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.
0 Kudos
Steven_L_Intel1
Employee
571 Views
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.
0 Kudos
Reply