- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have some code which is behaving strangely when I set a pointer to point to an allocatable scalar that is a member of a user defined type.
When I run the attached short stretch of code I get different output from the WRITE statements in the AddElement subroutine, with only the first WRITE giving meaningful output. The confusing extract is
e%content(pos)%element%dbg = 'CL'
p => e%content(pos)%element
WRITE (*,"('1>',A)") e%content(pos)%element%dbg
WRITE (*,"('2>',A)") p%dbg
I would have thought that the two lines of output would have to be the same, even in the face of a gross error somewhere else.
The code works as I would expect if I remove one level of procedure call (set this_is_driving_me_crazy to .FALSE., as far as I can tell B to B is the same code as A to A), or change the allocatable scalar to be a rank one, size one array (lines marked "! C" replace similar lines).
What am I missing????
All this with 11.0.066.
Thanks for any ... pointers ...
IanH
When I run the attached short stretch of code I get different output from the WRITE statements in the AddElement subroutine, with only the first WRITE giving meaningful output. The confusing extract is
e%content(pos)%element%dbg = 'CL'
p => e%content(pos)%element
WRITE (*,"('1>',A)") e%content(pos)%element%dbg
WRITE (*,"('2>',A)") p%dbg
I would have thought that the two lines of output would have to be the same, even in the face of a gross error somewhere else.
The code works as I would expect if I remove one level of procedure call (set this_is_driving_me_crazy to .FALSE., as far as I can tell B to B is the same code as A to A), or change the allocatable scalar to be a rank one, size one array (lines marked "! C" replace similar lines).
What am I missing????
All this with 11.0.066.
Thanks for any ... pointers ...
IanH
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - IanH
I have some code which is behaving strangely when I set a pointer to point to an allocatable scalar that is a member of a user defined type.
When I run the attached short stretch of code I get different output from the WRITE statements in the AddElement subroutine, with only the first WRITE giving meaningful output. The confusing extract is
e%content(pos)%element%dbg = 'CL'
p => e%content(pos)%element
WRITE (*,"('1>',A)") e%content(pos)%element%dbg
WRITE (*,"('2>',A)") p%dbg
I would have thought that the two lines of output would have to be the same, even in the face of a gross error somewhere else.
The code works as I would expect if I remove one level of procedure call (set this_is_driving_me_crazy to .FALSE., as far as I can tell B to B is the same code as A to A), or change the allocatable scalar to be a rank one, size one array (lines marked "! C" replace similar lines).
What am I missing????
All this with 11.0.066.
Thanks for any ... pointers ...
IanH
When I run the attached short stretch of code I get different output from the WRITE statements in the AddElement subroutine, with only the first WRITE giving meaningful output. The confusing extract is
e%content(pos)%element%dbg = 'CL'
p => e%content(pos)%element
WRITE (*,"('1>',A)") e%content(pos)%element%dbg
WRITE (*,"('2>',A)") p%dbg
I would have thought that the two lines of output would have to be the same, even in the face of a gross error somewhere else.
The code works as I would expect if I remove one level of procedure call (set this_is_driving_me_crazy to .FALSE., as far as I can tell B to B is the same code as A to A), or change the allocatable scalar to be a rank one, size one array (lines marked "! C" replace similar lines).
What am I missing????
All this with 11.0.066.
Thanks for any ... pointers ...
IanH
TYPE(Element), ALLOCATABLE :: element
gives
Error: This scalar name is invalid in this context [ELEMENT]
pointing to the member 'element'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - gib
It is interesting that ifort 10.1.011 cannot compile this program. The line
TYPE(Element), ALLOCATABLE :: element
gives
Error: This scalar name is invalid in this context [ELEMENT]
pointing to the member 'element'.
TYPE(Element), ALLOCATABLE :: element
gives
Error: This scalar name is invalid in this context [ELEMENT]
pointing to the member 'element'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a compiler bug. It is not handling the p%dbg reference properly. I have reported it as issue DPD200111953.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Steve Lionel (Intel)
This is a compiler bug. It is not handling the p%dbg reference properly. I have reported it as issue DPD200111953.
Thanks for the help. I'll work around it in the meantime by using a size one allocatable array.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The developers tell me that this bug has been fixed for the next release (May/June timeframe). Thanks for reporting it.
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