[Patch, fortran] PR29565 - [4.1/4.2/4.3 Regression] ICE in gimplify_var_or_parm_decl, at gimplify.c

Paul Thomas paulthomas2@wanadoo.fr
Wed Nov 1 18:08:00 GMT 2006


:ADDPATCH fortran:

This PR comes about because gfortran, at present, makes a temporary to 
pass a component reference in an array of derived types.  Recently, the 
copy of the data to the temporary, before the call, was removed for 
INTENT(OUT) dummies.  This works correctly for large temporaries or for 
up to two calls of the procedure.  This latter I still have not fully 
understood; take a look at the code for the testcase - The declarations 
for the 2nd and 3rd temporaries are present, albeit in odd places, but 
there is no sign of the first.  The nub of the problem is that the 
declarations for the temporaries are contained in the code blocks of the 
scalarizer.  Since the loops are not written in the case of INTENT(OUT) 
dummies, the declarations of temporaries on the stack are not retained.

The patch works by merging the loop blocks to the current scope.  This 
has the side effect of preserving all the declarations; which is fine 
for rank 1 but generates a few extraneous integer declaration for rank > 
1.  I decided that this was better than copying unnecessarily to the 
temporary and is the most economical way of fixing this kludge.  The 
testcase is a reduced version of that of the reporter.

OK for trunk, 4.2 and 4.1?

Paul

2006-11-01  Paul Thomas <pault@gcc.gnu.org>

    PR fortran/29565
    * trans-expr.c (gfc_conv_aliased_arg): For an INTENT(OUT), save
    the declarations from the unused loops by merging the block
    scope for each; this ensures that the temporary is declared.

2006-11-01  Paul Thomas  <pault@gcc.gnu.org>

    PR fortran/29565
    * gfortran.dg/gfortran.dg/aliasing_dummy_3.f90: New test.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr29565.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061101/06bbe235/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Change.Logs
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061101/06bbe235/attachment-0001.ksh>


More information about the Fortran mailing list