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

Pointer to array section and vector subscripts

Gustavo_Colvero
Beginner
510 Views
Hi, I'm trying to make a pointer point to an array subsection resolved by a vector subscript, but I found it
not to be possible.

Given
[fortran]DOUBLE PRECISION, DIMENSION(5,5), TARGET :: arrA
DOUBLE PRECISION, DIMENSION(:,:), POINTER :: ptr1
[/fortran]
the assignment
[fortran]ptr1 => arrA(1:3,(/2,4/)) [/fortran]
was intended to make pointer ptr1 point to the subsection of arrA constituted of its columns 2 and 4 for
rows 1 to 3, but I get the error
[fortran]#6797: A vector subscript is not permitted in an array section target subobject[/fortran]
Is it possible to do something like this?

Thanks.

PS: I'm not using a triplet on the second index because, in practice, I'll select more columns without a
regular stride.
0 Kudos
2 Replies
Steven_L_Intel1
Employee
510 Views
No - the standard explicitly forbids data-target from being an array section with a vector subscript. (Constraint C724 in Fortran 2008).
0 Kudos
Gustavo_Colvero
Beginner
510 Views
Ok. I'll work some bypass.

Thanks.
0 Kudos
Reply