This is the mail archive of the gcc-patches@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]

Re: [Patch, Fortran] PR 52151: reallocation w/ RESHAPE: also set stride


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


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