Bug 82660 - Bounds checking in conversions of intrinsic functions
Summary: Bounds checking in conversions of intrinsic functions
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: Fortran_bounds_checking 29600
  Show dependency treegraph
 
Reported: 2017-10-22 13:26 UTC by Thomas Koenig
Modified: 2018-01-13 13:58 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-10-22 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Koenig 2017-10-22 13:26:40 UTC
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.
Comment 1 Dominique d'Humieres 2017-10-22 13:42:01 UTC
Confirmed from 4.8 up to trunk (8.0). Many be related to pr82243.