https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82660
Bug ID: 82660 Summary: Bounds checking in conversions of intrinsic functions 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: --- This variant of maxloc_bounds_4.f90 module tst contains subroutine foo(res) integer(kind=4), allocatable :: f(:,:) integer(kind=8) , dimension(:) :: res allocate (f(2,5)) f = 3 res = maxloc(f) end subroutine foo end module tst program main use tst implicit none integer(kind=8) :: res(3) call foo(res) end program main does not trigger a bounds check with -fcheck=all. It is translated to ASSIGN foo:res(FULL) __convert_i4_i8[[((_gfortran_maxloc0_4_i4[[((foo:f(FULL)) ((arg not-present)) ((arg not-present)))]]))]] and the __convert_i4_i8 call hides the conversion from the library code for bounds checking, and does not do any bounds checking by itself.