This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/18857] MATMUL failing with ALLOCATED matrices, unless base indices given
- From: "tobi at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Apr 2005 10:28:59 -0000
- Subject: [Bug libfortran/18857] MATMUL failing with ALLOCATED matrices, unless base indices given
- References: <20041206185831.18857.paulthomas2@wanadoo.fr>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From tobi at gcc dot gnu dot org 2005-04-29 10:28 -------
Thanks for investigating, I had an exchange with Paul Brook about this yesterday
on the mailing list, and I think I understand what's happening now. Basically,
some of the information in the array descriptor is redundant.
An array element can be accessed in either of the following two ways:
data[offset + index0*stride0 + index1*stride1 + index2*stride2]
and
data[(index0-lbound0)*stride0 + (index1-lbound1)*stride1]
The library uses the latter way, so the offset is not needed there.
BTW this also answers the question of ssize_t vs size_t we were dicussing
before: correct overflow only plays a role when one uses the first way, and this
is only used in compiler-generated code.
The library only uses the latter kind of indexing and therefore using ssize_t
should work correctly under all circumstances.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18857