https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92000
Bug ID: 92000
Summary: Fortran array passing optimization
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: tkoenig at gcc dot gnu.org
Target Milestone: ---
The following code
program main
integer :: a(2)
a(1) = 1
a(2) = 42
call foo(a(1:1),1)
if (a(2) .ne. 42) stop "bletchful"
end
need not execute the check if a(2) is 42, and the call to
_gfortran_stop_string can be optimized away.
The same goes for
program main
integer :: a(2)
a(1) = 1
a(2) = 42
call foo(a(1),1)
if (a(2) .ne. 42) stop "bletchful"
end
There is a lot of broken code which assumes that the check is necessary,
so we should probably do this optimization contingent only if
-fallow-argument-mismatch is not in effect.