This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, fortran] PR20779 and PR20891 - allocation of STAT or specification variables in same call
- From: Paul Thomas <paulthomas2 at wanadoo dot fr>
- To: patch <gcc-patches at gcc dot gnu dot org>, "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>
- Date: Sun, 17 Sep 2006 19:36:34 +0200
- Subject: [Patch, fortran] PR20779 and PR20891 - allocation of STAT or specification variables in same call
: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.