On Fri, May 17, 2019 at 02:16:36PM +0200, Jakub Jelinek wrote:
> As the attached testcase shows, that can't be intentional, as that
> testcase fails to link.
Forgot to attach the testcases (that said, it would be better to write
something cleaner, perhaps one call for each library entry-point to be
tested, not really sure how best to iterate over all supported kinds)
that fail to link without these patches.
Jakub
! { dg-do run }
! Various tests with findloc.
program main
implicit none
integer(kind=2), dimension(2,2) :: a, b
integer, dimension(2,3) :: c
logical, dimension(2,2) :: lo
integer, dimension(:), allocatable :: e
a = reshape([1,2,3,4], shape(a))
b = reshape([1,2,1,2], shape(b))
lo = .true.
if (any(findloc(a, 5) /= [0,0])) stop 1
if (any(findloc(a, 5, back=.true.) /= [0,0])) stop 2
if (any(findloc(a, 2) /= [2,1])) stop 2
if (any(findloc(a, 2 ,back=.true.) /= [2,1])) stop 3
if (any(findloc(a,3,mask=lo) /= [1,2])) stop 4
if (any(findloc(a,3,mask=.true.) /= [1,2])) stop 5
lo(1,2) = .false.
if (any(findloc(a,3,mask=lo) /= [0,0])) stop 6
if (any(findloc(b,2) /= [2,1])) stop 7
if (any(findloc(b,2,back=.true.) /= [2,2])) stop 8
if (any(findloc(b,1,mask=lo,back=.true.) /= [1,1])) stop 9
if (any(findloc(b,1,mask=.false.) /= [0,0])) stop 10
c = reshape([1,2,2,2,-9,6], shape(c))
if (any(findloc(c,value=2,dim=1) /= [2,1,0])) stop 11
if (any(findloc(c,value=2,dim=2) /= [2,1])) stop 12
end program main
! { dg-do run }
! Various tests with findloc.
program main
implicit none
real(kind=10), dimension(2,2) :: a, b
integer, dimension(2,3) :: c
logical, dimension(2,2) :: lo
integer, dimension(:), allocatable :: e
a = reshape([1.,2.,3.,4.], shape(a))
b = reshape([1.,2.,1.,2.], shape(b))
lo = .true.
if (any(findloc(a, 5.) /= [0,0])) stop 1
if (any(findloc(a, 5., back=.true.) /= [0,0])) stop 2
if (any(findloc(a, 2.) /= [2,1])) stop 2
if (any(findloc(a, 2. ,back=.true.) /= [2,1])) stop 3
if (any(findloc(a,3.,mask=lo) /= [1,2])) stop 4
if (any(findloc(a,3,mask=.true.) /= [1,2])) stop 5
lo(1,2) = .false.
if (any(findloc(a,3.,mask=lo) /= [0,0])) stop 6
if (any(findloc(b,2.) /= [2,1])) stop 7
if (any(findloc(b,2.,back=.true.) /= [2,2])) stop 8
if (any(findloc(b,1.,mask=lo,back=.true.) /= [1,1])) stop 9
if (any(findloc(b,1.,mask=.false.) /= [0,0])) stop 10
c = reshape([1,2,2,2,-9,6], shape(c))
if (any(findloc(c,value=2,dim=1) /= [2,1,0])) stop 11
if (any(findloc(c,value=2,dim=2) /= [2,1])) stop 12
end program main