https://gcc.gnu.org/bugzilla/show_bug.cgi?id=32317
Dominique d'Humieres <dominiq at lps dot ens.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |WAITING --- Comment #9 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- Note that compiling the test module mod implicit none contains subroutine a(v) real,dimension(8),intent(in)::v write(*,*)v end subroutine a subroutine b real,dimension(5)::v v=0 call a(v(1:4)) end subroutine b end module mod gives pr32317_db_2.f90:14:7: call a(v(1:4)) 1 Warning: Actual argument contains too few elements for dummy argument 'v' (4/8) at (1) In order to get the same warning with the code in comment 0, the value 8 in call a(8,v(1:4)) has to be propagated to 'n' in subroutine a(n,v), but the gfortran from-end does not do constant propagation which is left to the middle-end. > Can someone with a better understanding of the standard than me comment > as to whether this is actually legal Fortran when there is an explicit > interface known? I certainly won't claim that I have "a better understanding of the standard", but I am pretty sure that the for the example the burden is on the user and not on the compiler: AFAIK the standard does not say that constants should be propagated. In addition AFAIU -fcheck=bounds, it is pretty naive, i.e., it checks that v(i) in subroutine a is not accessed with i<1 or i>n. Considering that this PR is (IMO) based on wrong expectations and did not have any activity for more than six years, I'll close it as WONTFIX without (prompt) feedback.