This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH] fortran/36153 -- Fix complicationn due to KIND in SIZE
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Tobias Burnus <tobias dot burnus at physik dot fu-berlin dot de>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Sat, 30 Aug 2008 06:43:46 -0700
- Subject: Re: [PATCH] fortran/36153 -- Fix complicationn due to KIND in SIZE
- References: <20080830105915.GA7119@physik.fu-berlin.de>
On Sat, Aug 30, 2008 at 12:59:22PM +0200, Tobias Burnus wrote:
> > The attached patch fixes the problem in PR fortran/36153.
> >
> > + if (strncmp(arg->next->name, "kind", 4) == 0)
> > + break;
> > +
>
> The patch cases an ICE (segfault) for several testcases, e.g.:
> libgomp.fortran/allocatable1.f90
>
> $ gfortran libgomp.fortran/allocatable4.f90
>
> shows in valgrind:
>
> ==23517== Invalid read of size 1
> ==23517== at 0x4680D7: gfc_resolve_expr (resolve.c:2311)
> ==23517== by 0x46C1B2: resolve_operator (resolve.c:2921)
> ==23517== by 0x4673AC: gfc_resolve_expr (resolve.c:4549)
> ==23517== by 0x46C213: resolve_operator (resolve.c:2912)
>
> Line 2311 is:
> + if (strncmp(arg->next->name, "kind", 4) == 0)
>
Whoops, I forgot to do the regression test. It's been a while.
This appears to fix the problem
if (arg->next->name && strncmp(arg->next->name, "kind", 4) == 0)
but I currently don't understand why arg->next->name would be
NULL for size(array,1).
--
Steve