public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/96890] New: Wrong answer with intrinsic IALL
@ 2020-09-02  1:19 zhen.xu@compiler-dev.com
  2020-09-02 21:17 ` [Bug libfortran/96890] " anlauf at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: zhen.xu@compiler-dev.com @ 2020-09-02  1:19 UTC (permalink / raw)
  To: gcc-bugs

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.xu@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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-09-09 19:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-02  1:19 [Bug fortran/96890] New: Wrong answer with intrinsic IALL zhen.xu@compiler-dev.com
2020-09-02 21:17 ` [Bug libfortran/96890] " anlauf at gcc dot gnu.org
2020-09-03  4:56 ` kargl at gcc dot gnu.org
2020-09-03 14:32 ` anlauf at gcc dot gnu.org
2020-09-03 14:40 ` sgk at troutmask dot apl.washington.edu
2020-09-03 15:07 ` anlauf at gcc dot gnu.org
2020-09-03 18:33 ` cvs-commit at gcc dot gnu.org
2020-09-03 18:51 ` anlauf at gcc dot gnu.org
2020-09-08 20:20 ` cvs-commit at gcc dot gnu.org
2020-09-09 19:39 ` cvs-commit at gcc dot gnu.org
2020-09-09 19:43 ` cvs-commit at gcc dot gnu.org
2020-09-09 19:44 ` anlauf at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).