[patch, fortran] Handle missing optional MASK for intrinsics

Dominique d'Humières dominiq@lps.ens.fr
Mon Dec 31 14:52:00 GMT 2018


Hi Thomas,

Another glitch: the following test (reduced from gfortran.dg/optional_absent_4.f90)

module z
  implicit none
contains

  subroutine findloc_4 (input, val, res, mask)
    logical, intent(in), optional :: mask(:,:)
    integer, intent(in) :: input(:,:)
    integer, dimension(:), intent(out) :: res
    integer, intent(in) :: val
    integer :: n = 1
    res = findloc(input, val, dim=n)
  end subroutine findloc_4

end module z

program main
  use z
  implicit none
  integer :: i2(2,3) = reshape([1,2,4,8,16,32], [2,3])
  integer, dimension(3) :: res3
  res3 = -2
  call findloc_4 (i2, 4, res3)

end program main

gives at runtime

a.out(77719,0x10335e5c0) malloc: Incorrect checksum for freed object 0x7fb131403d50: probably modified after being freed.
Corrupt value: 0x0
a.out(77719,0x10335e5c0) malloc: *** set a breakpoint in malloc_error_break to debug

Program received signal SIGABRT: Process abort signal.

TIA,

Dominique



More information about the Fortran mailing list