This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, fortran] PR25029 - Assumed size array can be associated with array pointer without upper bound of last dimension
- From: Paul Thomas <paulthomas2 at wanadoo dot fr>
- To: Tobias SchlÃter <tobias dot schlueter at physik dot uni-muenchen dot de>
- Cc: patch <gcc-patches at gcc dot gnu dot org>, "'fortran at gcc dot gnu dot org'" <fortran at gcc dot gnu dot org>
- Date: Thu, 22 Dec 2005 18:50:42 +0100
- Subject: Re: [Patch, fortran] PR25029 - Assumed size array can be associated with array pointer without upper bound of last dimension
- References: <43A52D44.8010301@wanadoo.fr> <43A56457.4000903@physik.uni-muenchen.de> <43AA691B.8000407@wanadoo.fr>
Tobi,
Please find below a Band-Aid patch for this.
In committing this patch with that for the initialization, the
pre-commit regtest threw up an interaction between the two;
This line in initialization_1.f90 went from a warning to an error:
For an assumed size 2-D array, x,
integer :: m3 = size (x, 1) ! { dg-warning "Evaluation of
nonstandard initialization" }
This is consistent with commercial compiler behaviour, but not quite
correct. Since it is a slightly obscure corner of the standard, I
have eliminated the line in the test and committed the patch as is. I
will correct the condition that inhibits this line and will submit a
patch tonight or tomorrow. Other than this one line in a new test,
the regtest was OK. I hope that this is acceptable.
I have been through all the intrinsics and find that only SIZE and
UBOUND are affected negatively; all the rest are improved and behave in
the same way as ifort. Thus, the following fixes the problem. These
inquiry functions already have checks for assumed-size arrays that are
more sophisticated than the global check that is in my patch. I will
look for a more elegant solution over the holiday period and develop
(some) test case(s).
I will commit tomorrow morning, unless there are any objections.
Cheers
Paul
PR fortran/25029
PR fortran/21256
*resolve.c(resolve_function): Remove assumed size checking for SIZE
and UBOUND and rely on their built-in checking.
Index: gcc/fortran/resolve.c
===================================================================
*** gcc/fortran/resolve.c (revision 108943)
--- gcc/fortran/resolve.c (working copy)
*************** resolve_function (gfc_expr * expr)
*** 1231,1237 ****
else if (expr->value.function.actual != NULL
&& expr->value.function.isym != NULL
! && strcmp (expr->value.function.isym->name, "lbound"))
{
/* Array instrinsics must also have the last upper bound of an
asumed size array argument. */
--- 1231,1239 ----
else if (expr->value.function.actual != NULL
&& expr->value.function.isym != NULL
! && strcmp (expr->value.function.isym->name, "lbound")
! && strcmp (expr->value.function.isym->name, "ubound")
! && strcmp (expr->value.function.isym->name, "size"))
{
/* Array instrinsics must also have the last upper bound of an
asumed size array argument. */