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 fortran/31320] Illegal read with gfortran.dg/alloc_comp_assign_2.f90 and *_3.f90



------- Comment #5 from dfranke at gcc dot gnu dot org  2007-07-05 16:32 -------
Tobias, good catch :)

It seems to be another off-by-one issue. Comparing the tree dumps from
different assignments as shown in comment #4, one learns (copied only the
relevant lines, between any two adjacent lines any amount of other code was
removed):

    struct a a.0;
      struct array1_int4 parm.2;
      parm.2.dim[0].ubound = 3;
      a.0.i = (struct array1_int4) parm.2;             /* ubound == 3 */
      a.0.i.dim[0].ubound = a.0.i.dim[0].ubound + 1;   /* ubound == 4 (!) */
    x = a.0;

Adding
  print *, ubound(x%i, 1), ubound(y%i, 1)
to the source gives 4/4 instead of 3/3 as one would expect from the initalizer.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31320


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