This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] PR25029 - Assumed size array can be associated with array pointer without upper bound of last dimension


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.  */



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]