- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm trying to learn to use the ASSOCIATE statement (i.e., trying to see if I understood correctly what such statement intends to do). I have the following test:
program test
implicit none
type tabletype
integer :: p, q
end type
type globaltype
type(tabletype), allocatable :: table(:,:)
end type
integer :: i
type(globaltype), target :: global
integer, pointer :: p2q(:,:)
continue
allocate (global%table(10,10))
ASSOCIATE (p => global%table%p)
p = RESHAPE([(i, i = 1, 100)], [10,10])
write (*,'(10(10I5/))') p
END ASSOCIATE
p2q => global%table%q
p2q = RESHAPE([(i, i = 1, 100)], [10,10])
write (*,'(10(10I5/))') p2q
nullify(p2q)
end program test
When I try to compile this source code, I get:
internal error: Please visit 'http://www.intel.com/software/products/support' for assistance.
ASSOCIATE (p => global%table%p)
^
[ Aborting due to internal error. ]
compilation aborted for test.f90 (code 1)
So my question is, am I using the ASSOCIATE statement right (i.e., as a replacement for pointers like p2q) or not?
John.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ASSOCIATE (p => global%table%p)
I guess this violates the rule against using ASSOCIATE to redefine a name. The compiler ought to say what is wrong, rather than throw an internal error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I guess this violates the rule against using ASSOCIATE to redefine a name.
Yes, it was my fault for not writing a test case that represents exactly the code I have (i.e., in my code, the target values are never modified when accessed through the pointer). Anyway, the following code stills throws the same internal error:
program test
implicit none
type tabletype
integer :: p, q
end type
type globaltype
type(tabletype), allocatable :: table(:,:)
end type
integer :: i
type(globaltype), target :: global
integer, pointer :: p2q(:,:)
continue
allocate (global%table(10,10))
global%table%p = RESHAPE([(i, i = 1, 100)], [10,10])
ASSOCIATE (p => global%table%p)
write (*,'(10(10I5/))') p
END ASSOCIATE
p2q => global%table%q
p2q = RESHAPE([(i, i = 1, 100)], [10,10])
write (*,'(10(10I5/))') p2q
nullify(p2q)
end program test
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - I can reproduce this and have passed it on to development. Our issue ID is DPD200110830. I will let you know of any progress.
- 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