------- Comment #1 from burnus at gcc dot gnu dot org 2008-03-27 18:27 ------- Confirm. Note NAG f95 complains the program is invalid and I think it is right:
Error: Explicit interface required for MG0028 from TRY_MG0028 - argument TDA2R (no. 1) is a TARGET But this does not solve the gfortran problem ;-) >From the standard: (v) applies here, but (vii) is analog - except that TARGET is a pointer instead of a target. "Case (v): If TARGET is present and is an array target, the result is true if the target associated with POINTER and TARGET have the same shape, are neither of size zero nor arrays whose elements are zero-sized storage sequences, and occupy the same storage units in array element order. Otherwise, the result is false. If POINTER is disassociated, the result is false." gfortran is failing since in dimension 1 they have different strides: Pointer: 2:1:-2 (namely: element 2) Target: 2:2:1 (namely: element 2) However, libgfortran/intrinsics/associated.c only checks whether the stride is the same. Proposed patch: Index: libgfortran/intrinsics/associated.c =================================================================== --- libgfortran/intrinsics/associated.c (Revision 133633) +++ libgfortran/intrinsics/associated.c (Arbeitskopie) @@ -48,10 +48,12 @@ associated (const gfc_array_void *pointe rank = GFC_DESCRIPTOR_RANK (pointer); for (n = 0; n < rank; n++) { - if (pointer->dim[n].stride != target->dim[n].stride) + long extent; + extent = pointer->dim[n].ubound - pointer->dim[n].lbound; + + if (extent != (target->dim[n].ubound - target->dim[n].lbound)) return 0; - if ((pointer->dim[n].ubound - pointer->dim[n].lbound) - != (target->dim[n].ubound - target->dim[n].lbound)) + if (pointer->dim[n].stride != target->dim[n].stride && extent != 0) return 0; if (pointer->dim[n].ubound < pointer->dim[n].lbound) return 0; -- burnus at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |burnus at gcc dot gnu dot | |org Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2008-03-27 18:27:43 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35721