This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] PR 52151: reallocation w/ RESHAPE: also set stride
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: Tobias Burnus <burnus at net-b dot de>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Wed, 8 Feb 2012 10:02:56 -0800
- Subject: Re: [Patch, Fortran] PR 52151: reallocation w/ RESHAPE: also set stride
- References: <4F32B4DB.20901@net-b.de>
On Wed, Feb 08, 2012 at 06:46:03PM +0100, Tobias Burnus wrote:
>
> this patch is a follow up to the recent patch on RESHAPE with an
> allocatable LHS. It turned out that if the LHS is not allocated or has
> the wrong shape, the bounds are not correctly set. Or to be precise: The
> just internally used* "stride" is not set correctly.
>
> Result: Either the wrong elements were accessed or - in particular for
> unallocated arrays with "garbage" or malloc_perturb_ initialization - a
> segfault occurred. Especially the case of having the wrong values is nasty!
>
> The bug was found by Dominique, who found it when looking at the
> chapter08/puppeteer_f2003 example in Damian (et al.)'s book. Thanks
> Dominique!
>
> While that's not a regression, I think the bug is seriously enough and
> the fix simple enough that it should also be applied to 4.6.
>
> Thus: OK for the trunk and 4.6? (The patch has been build and regtested
> on x86-64-linux.)
>
OK for both trunk and 4.6. Thanks for tracking down the problem.
--
Steve