This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libfortran/18857] MATMUL failing with ALLOCATED matrices, unless base indices given


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]