https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96890

            Bug ID: 96890
           Summary: Wrong answer with intrinsic IALL
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhen...@compiler-dev.com
  Target Milestone: ---

I got wrong answer with iall, only when all 3 parameters ARRAY/DIM/MASK are all
present and the rank of array >1.

---------------------------test code-----------------------
program test_f90_intrinsics
  integer :: i, j, k
  integer, dimension(2) :: ia1
  integer, dimension(2,2) :: ia2
  integer, dimension(2,2,2) :: ia3
  integer, dimension(2,2,2,2) :: ia4
  logical, dimension(2) :: mask1
  logical, dimension(2, 2) :: mask2
  logical, dimension(2, 2, 2) :: mask3
  logical, dimension(2, 2, 2, 2) :: mask4

  data ia1 /  1,  2 /
  data ia2 /  1,  2,  3, 4 /
  data ia3 /  1,  2,  3, 4,  5,  6,  7, 8 /
  data ia4 /  1,  2,  3, 4,  5,  6,  7, 8, &
    9, 10, 11, 12, 13, 14, 15, 16 /

  data mask1 / .true., .false. /
  data mask2 / .true., .false., .true., .false. /
  data mask3 / .true., .false., .true., .false., &
    .true., .false., .true., .false. /
  data mask4 / .true., .false., .true., .false., &
    .true., .false., .true., .false., .true., &
    .false., .true., .false., .true., .false., &
    .true., .false. /


  print *, '---------test 1-----------'
  print *, iall(ia2, 2, mask2)

  print *, '---------test 2-----------'
  print *, iall(ia3, 2, mask3)

  print *, '---------test 3-----------'
  print *, iall(ia4, 2, mask4)

end
-----------------------------------------------------------

With gfortran I got wrong result:
---------test 1-----------
          0           0
---------test 2-----------
          0           0           0           0
---------test 3-----------
          0           0           0           0           0           0        
  0           0


The expected result(checked with ifort) should be:
---------test 1-----------
           1           -1
---------test 2-----------
           1           -1            5           -1
---------test 3-----------
           1           -1            5           -1            9           -1
          13           -1

Reply via email to