[Patch, fortran] PR20779 and PR20891 - allocation of STAT or specification variables in same call

Paul Thomas paulthomas2@wanadoo.fr
Sun Sep 17 17:36:00 GMT 2006


:ADDPATCH fortran:

This patch provides a diagnostic of standard violating code, which has:

allocate (i, x(i)) or allocate (i, stat = i) ;

ie. allocation of objects used in specification expressions or of the 
stat variable, within the same allocate statement.  The bit of the patch 
that deals with the stat variable being allocated is straight forward; 
each new variable to be allocated has its symbol checked against the 
symbol for stat.  If the two are the same, this is an error.  The 
specification expressions are a bit more complicated; each symbol to be 
allocated is checked by a new recursive function against the symbols 
referenced in all the specification expressions in the allocate 
statement.  The testcase combines those received from each reporter.

Regtested on FC5/Athlon - OK for trunk and 4.1?

Paul

2006-09-17 Paul Thomas <pault@gcc.gnu.org>

    PR fortran/20779
    PR fortran/20891
    * resolve.c (find_sym_in_expr): New function that returns true
    if a symbol is found in an expression.
    (resolve_allocate_expr): Check whether the STAT variable is
    itself allocated in the same statement.  Use the call above to
    check whether any of the allocated arrays are used in array
    specifications in the same statement.

2006-09-17 Paul Thomas <pault@gcc.gnu.org>

    PR fortran/20779
    PR fortran/20891
    * gfortran.dg/alloc_alloc_expr_1.f90: New test.



More information about the Fortran mailing list