Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

error #6691 test case

Charles_K_1
Beginner
1,043 Views

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.

0 Kudos
1 Solution
Steven_L_Intel1
Employee
1,043 Views

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.)

View solution in original post

0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,044 Views

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.)

0 Kudos
Charles_K_1
Beginner
1,043 Views

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.

0 Kudos
Reply