- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- Balises:
- Intel® Fortran Compiler
Lien copié
5 Réponses
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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'.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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'.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
This is a compiler bug. It is not handling the p%dbg reference properly. I have reported it as issue DPD200111953.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
The developers tell me that this bug has been fixed for the next release (May/June timeframe). Thanks for reporting it.
Répondre
Options du sujet
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable