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

            Bug ID: 86735
           Summary: [8/9 Regression] Bad wrong-code bug with
                    "-march=skylake-avx512 -Ofast"
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janus at gcc dot gnu.org
  Target Milestone: ---

Consider this simple test case:


program avx512_bug

   implicit none

   integer, dimension(:), allocatable :: list
   integer, parameter :: maxList = 32
   integer :: i

   allocate(list(1:maxList))
   do i=1,maxList
      list(i) = i
   end do

   call test(list)

contains

   subroutine test(a)
      integer, dimension(:), intent(in) :: a
      integer, parameter :: maxSamples = 16
      integer, dimension(1:maxSamples) :: iarr
      integer :: i, cnt, nbSamples

      cnt = ubound(a,1)
      nbSamples = min(maxSamples, cnt)
      do i=1,nbSamples
         iarr(i) = i
      end do

      print *, iarr(1:nbSamples)
      print *, a(iarr(1:nbSamples))

   end subroutine

end


It should print the sequence from 1 to 16 twice, which it does with gfortran
versions up to 7.

With 8.2.0 and trunk, however, the second line has varying random numbers when
the code is compiled with "-march=skylake-avx512 -Ofast".

-march=skylake works, -O3 works as well.

Reply via email to