https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83920
--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> --- (In reply to Tom de Vries from comment #3) > Likewise, reversing the if-then-else order in gemm.f90 makes the testcase > fail on trunk without this patch. Minimal version: ... ! { dg-do run } subroutine gemm (BETA, C) real :: C(100,100) integer :: i, j, l real, parameter :: one = 1.0 real :: beta !$acc parallel copy(c(1:100,1:100)) num_gangs(2) !$acc loop gang do j = 1, 100 if (beta /= one) then !$acc loop vector do i = 1, 100 C(i,j) = 0.0 end do end if end do !$acc end parallel end subroutine gemm program test_gemm real :: c(100,100), beta beta = 0.0 c(:,:) = 1.0 call gemm (beta, c) if (c(1,1) /= 0.0) call abort () end program test_gemm ... Passes at O0, fails at O1 and higher.