- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I ran into a compilation error #6691: "A pointer dummy argument may only be argument associated with a pointer."
I generated a test case for it, which I'm including. I can solve the error by removing the pointer attribute to the dummy argument in subroutine leg_b_only_action(), though I don't see why that would be necessary since the calling unit (in this case is main) does pass a pointer thas has been checked to be of the right class. I'm trying to determine what I'm not getting right.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Inside the SELECT TYPE, SOMETHING isn't a pointer. The standard says (emphasis mine):
11 3 If the selector has the POINTER attribute, it shall be associated; the associate name is associated with the target
12 of the pointer and does not have the POINTER attribute.
It's confusing that you have two variables called SOMETHING, but they aren't the same thing. Inside the SELECT TYPE, an entirely new variable is created that has some of the attributes of the selector but not all of them.
While Corrigendum 2 relaxes the restrictions on POINTER dummy arguments a bit, allowing you to pass a non-pointer to an INTENT(IN) POINTER, you have INTENT(INOUT). so that doesn't apply. (We have not fully implemented this change, however.)
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Inside the SELECT TYPE, SOMETHING isn't a pointer. The standard says (emphasis mine):
11 3 If the selector has the POINTER attribute, it shall be associated; the associate name is associated with the target
12 of the pointer and does not have the POINTER attribute.
It's confusing that you have two variables called SOMETHING, but they aren't the same thing. Inside the SELECT TYPE, an entirely new variable is created that has some of the attributes of the selector but not all of them.
While Corrigendum 2 relaxes the restrictions on POINTER dummy arguments a bit, allowing you to pass a non-pointer to an INTENT(IN) POINTER, you have INTENT(INOUT). so that doesn't apply. (We have not fully implemented this change, however.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Wow, ok. Thanks for that clarification. Clearly, I hadn't figured that point out yet. So if operations are to be performed on something inside the leg_b_only_action() and a pointer needs to be associated to the dummy variable, the answer is to specify target instead of pointer. Since we pass by reference, really, there is functionally no difference. Hopefully I got this right.
Thanks for the very speedy answer.

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