Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

associate construct in pure subroutine

tracyx
New Contributor I
529 Views
I am using ifort 11.1.056 and I am having problems with the associate construct in a pure subroutine. This is a simple test case.

pure subroutine test()
implicit none
type abc_t
real(8) :: d
real(8) :: e
end type abc_t
integer :: i
type(abc_t) :: abc
i = 0
abc%d = 0
associate (d => abc%d, e => abc%e)
do while (i<10)
i = i + 1
d = d + i
end do
end associate

end subroutine test


will give me the error,

"test.f90(18): error #7617: This host associated object appears in a 'defining' context in a PURE procedure or in an internal procedure contained in a PURE procedure.
i = i + 1"

however, if i use a normal do loop

associate (d => abc%d, e => abc%e)
do i = 1, 10
d = d + i
end do
end associate

then it compiles fine, as it does when i put the associate inside the do while loop

do while (i<=10)
associate (d => abc%d, e => abc%e)
i = i + 1
d = d + i
end associate
end do

Is this a bug or is there really a problem with using while loops inside associate?

Thanks

0 Kudos
2 Replies
Kevin_D_Intel
Employee
529 Views

This does appear to be a compiler bug and also has some relation to PURE. The original procedure compiles when not declaring the procedure PURE.

I sent the example to the Fortran Developers for their analysis/comment andwill post more when I learn it.

(Internal tracking id: DPD200140583)

(Resolution Update on 12/23/2009): This defect is fixed in the Intel Fortran Compiler Professional Edition 11.1 Update 4 (11.1.064 - Linux).
0 Kudos
Kevin_D_Intel
Employee
529 Views

This defect is fixed in the Intel Fortran Compiler Professional Edition 11.1 Update 4 (11.1.064 - Linux).
0 Kudos
Reply