- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This defect is fixed in the Intel Fortran Compiler Professional Edition 11.1 Update 4 (11.1.064 - Linux).

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