This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/31320] Illegal read with gfortran.dg/alloc_comp_assign_2.f90 and *_3.f90
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Jul 2007 13:47:17 -0000
- Subject: [Bug fortran/31320] Illegal read with gfortran.dg/alloc_comp_assign_2.f90 and *_3.f90
- References: <bug-31320-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from pault at gcc dot gnu dot org 2007-07-13 13:47 -------
(In reply to comment #5)
> 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.
This all happens in trans-expr.c(gfc_trans_subcomponent_assign):3007
The change for 0 to unity based indexing is done incorrectly - apparently, what
is assumed to be zero based comes through as something else... sometimes!
I think that the right thing to do here is to use the array_spec lower bound as
the base and to use the expression upper-lower as the range.
I'll see if I cannot post a fix in the next couple of days.
Paul
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31320