This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/38852] UBOUND fails for negative stride triplets
- From: "mikael at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Jan 2009 22:30:02 -0000
- Subject: [Bug fortran/38852] UBOUND fails for negative stride triplets
- References: <bug-38852-15620@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from mikael at gcc dot gnu dot org 2009-01-20 22:29 -------
(In reply to comment #3)
> DLA => DDA(2:3, 1:3:2, 5:4:-1, NF2, NF5:NF2:MF2)
>
> The descriptor built for DLA has negative strides for dimension >= 3.
> This makes ubound fail.
>
Forget this
DLA => DDA(2:3, 1:3:2, 5:4:-1, NF2, NF5:NF2:MF2)
dla.dim[0].lbound = 1;
dla.dim[0].ubound = 2;
dla.dim[0].stride = 1;
dla.dim[1].lbound = 1;
dla.dim[1].ubound = 2;
dla.dim[1].stride = 10;
dla.dim[2].lbound = 1;
dla.dim[2].ubound = 2;
dla.dim[2].stride = -25;
dla.dim[3].lbound = 1;
dla.dim[3].ubound = D.1563 + 1;
dla.dim[3].stride = D.1561 * 625;
There is a distinction to make between user-provided bounds and
front-end-generated bounds.
In the former case (original array) the array is non-empty if ubound >
lbound and stride > 0 or if ubound < lbound and stride < 0.
In the latter case, it is non-empty if ubound > lbound only. Comparing
ubound and lbound according to the stride to check for zero-sized arrays
doesn't make sense in this case (see dimension 2 of dla).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38852