- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Even though I understand that all compilers have bugs, I would have never expected to see this one. When compiling the following module, I get errors about i, j and k not being declared:
[fortran]module mod1 implicit none private integer, public :: nx, ny, nz type, public :: ArrayType real, allocatable :: a_g(:,:,:), a_k(:,:,:) end type type, public :: Test type(ArrayType) :: array contains procedure :: dosomething end type contains subroutine dosomething(this) class(Test), intent(INOUT) :: this integer :: i, j, k real, allocatable :: a_l(:,:,:), a_n(:,:,:) continue allocate (a_l(-1:nx+2, -1:ny+2, -1:nz+2), a_n(-1:nx+2, -1:ny+2, -1:nz+2)) associate (array => this%array, & a_g => array%a_g, & a_k => array%a_k) forall (i = 1:nx, j = 1:ny, k = 1:nz) a_l(i, j, k) = a_k(i, j, k) - a_g(i, j, k) end forall do k = 1, nz do j = 1, ny do i = 1, nx a_n(i, j, k) = SQRT(a_g(i, j, k) * a_g(i, j, k-1)) enddo enddo enddo end associate end subroutine end module mod1[/fortran] It seems to me that the compiler gets confused by the FORALL construct within an ASSOCIATE construct. Or am I missing something?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There seems to be something wrong with my newsfeeds updates, so I just found about your reply while looking for something else.
The "undeclaration" happened while moving some module variables to a derived type, and then using ASSOCIATE to avoid massively adding the this% prefix to the code. FORALL makes things easier to read, but since ASSOCIATE is actually quite useful here, a set of DO constructs will "do" just fine.
I've noticed that the release "later this year" seems to fix a lot of things... May I ask, how late this year?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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