POINTER Rank Remapping (From http://www.fortran.bcs.org/forum2002/f2000dme.htm) Motivation: ability to have pointers to diagonals of matrices.
REAL,ALLOCATABLE,TARGET :: base_array(:) REAL,POINTER :: matrix(:,:) REAL,POINTER :: diagonal(:) ... ALLOCATE(base_array(n*n)) matrix(1:n,1:n) => base_array ! rank remapping diagonal => base_array(::n+1) Notes: * The base array must be rank one, to ensure that the remapping is a simple linear transformation. * Both lower bound and upper bound must be specified for each dimension. Fortran 2003 standard, see "7.4.2.1 Data pointer assignment": "R735 pointer-assignment-stmt is data-pointer-object [ (bounds-spec-list) ] => data-target or data-pointer-object (bounds-remapping-list ) => data-target or proc-pointer-object => proc-target C718 (R735) If bounds-spec-list is specified, the number of bounds-specs shall equal the rank of data pointer-object. C719 (R735) If bounds-remapping-list is specified, the number of bounds-remappings shall equal the rank of data-pointer-object. C720 (R735) If bounds-remapping-list is specified, data-target shall have rank one; otherwise, the ranks of data-pointer-object and data-target shall be the same." and "7.4.2.1 Data pointer assignment": "If bounds-remapping-list is specified, data-target shall not be a disassociated or undefined pointer, and the size of data-target shall not be less than the size of data-pointer-object. The elements of the target of data-pointer-object, in array element order (6.2.2.2), are the first SIZE(data-pointer-object) elements of data-target." -- Summary: Fortran 2003: POINTER Rank Remapping Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org OtherBugsDependingO 20585 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29785