subroutine foo (a)
real a(*)
call bar (a, LBOUND(a),2)
end subroutine foo
subroutine bar (b, i, j)
real b(i:j)
print *, i, j
print *, b(i:j)
end subroutine bar


real x(10)
x = 0.0
call foo (x)
end

???

This runs fine with other brand compilers but gfortran, patched or not, gives:

tobi.f90: In function ‘foo’:
tobi.f90:1: fatal error: gfc_todo: Not Implemented: Unable to determine rank of
expression
compilation terminated.

If LBOUND (a) is replaced with LBOUND(a, 1), all is well. Alternatively,
assigning LBOUND (a) to an integer vector and using the vector as an actual
argument for bar works as well.

The message is emitted from trans-array.c:2393


void
gfc_conv_ss_startstride (gfc_loopinfo * loop)
{
.....
if (loop->dimen == 0)
gfc_todo_error ("Unable to determine rank of expression");

Since scalarization is not needed here, I am not sure how we got to
gfc_conv_ss_startstride.


-- 
           Summary: LBOUND (assumed-size-array), as actual arg,causes fatal
                    error.
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: paul dot richard dot thomas at cea dot fr


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25669


Reply via email to