Test which checks the omp do lastprivate clause by counting up a variable in a parallelized loop. Each thread saves the next summand in a lastprivate variable i0. At the end i0 is compared to the value of the expected last summand. 2.0 omp do private omp parallel firstprivate, omp critical INTEGER FUNCTION do_lastprivate() IMPLICIT NONE INTEGER sum,known_sum INTEGER sum0,i0,i COMMON /orphvars/ sum0,i0,i INCLUDE "omp_testsuite.f" sum = 0 sum0 = 0 i0 = -1 !$omp parallel firstprivate(sum0) !$omp do schedule(static,7) lastprivate(i0) DO i=1, LOOPCOUNT sum0 = sum0 + i i0 = i END DO !$omp end do !$omp critical sum = sum + sum0 !$omp end critical !$omp end parallel known_sum = (LOOPCOUNT*(LOOPCOUNT+1))/2 IF ( known_sum .EQ. sum .AND. i0 .EQ. LOOPCOUNT ) THEN = 1 ELSE = 0 END IF END FUNCTION