[Patch, fortran] Fix PR fortran/50050 breakage: ICE on valid with null pointer initialization

Mikael Morin mikael.morin@sfr.fr
Thu Sep 1 14:36:00 GMT 2011


On Wednesday 24 August 2011 10:58:19 Tobias Burnus wrote:
> On 08/24/2011 12:01 AM, Mikael Morin wrote:
> > this is an attempt to fix my recent breakage for PR50050.
> > I forgot that shape can't always be known, and thus, that for some
> > expressions, the shape field is a NULL pointer.
> > 
> > Neither bootstraped, nor regression tested, but it is in progress. My
> > machine does its best (which is not a lot) to have this properly
> > compiled and tested (and then committed) as soon as possible.
> > Otherwise OK for 4.{4..7} ?
> 
> OK for 4.6 and 4.7 (after regtesting).
> 
> As 4.4 and 4.5 are not affected by this regression and only by the
> original bug (comment 0 of PR 50050), please wait a while before
> committing the combined patch to older branches. (One could also
> consider whether having 50050c0 fixed on 4.6/4.7 is sufficient.)
> 
> Tobias

Hello,

Despite your call for less non-regression backports, I'm going to use the 
following (slightly less intrusive) variant for 4.5 and 4.4. I can't stand 
knowing this bug exists in the wild.

Mikael

PS: the testcase alloc_comp_initializer_3.f90 doesn't trigger on 4.5, so this 
patch fixes a silent memory out of bound (instead of an ICE). I add the 
testcase anyway, in case it could trigger on some targets.
-------------- next part --------------
2011-09-01  Mikael Morin  <mikael.morin@gcc.gnu.org>

	* resolve.c (gfc_expr_to_initialize): Don't copy rank.
	Free copied shape.  Recalculate shape and rank.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr50050_backport.diff
Type: text/x-patch
Size: 655 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110901/f21e63c1/attachment.bin>
-------------- next part --------------
2011-09-01  Mikael Morin  <mikael.morin@gcc.gnu.org>

	* gfortran.dg/alloc_comp_initializer_3.f90: New test.
	* gfortran.dg/pointer_comp_init.f90: New test.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alloc_comp_initializer_3.f90
Type: text/x-fortran
Size: 357 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110901/f21e63c1/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pointer_comp_init_1.f90
Type: text/x-fortran
Size: 636 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110901/f21e63c1/attachment-0002.bin>


More information about the Gcc-patches mailing list