
      PROGRAM test
	INTEGER N
	PARAMETER (N = 100000)

        REAL A(N), B(N)

        INTEGER I, J

        DO I = 1, N
          A(I) = 1.0
        END DO

        DO J = 1, 1000
          CALL PREFIX(B, A, N)
        END DO

        CALL CHECKP(B, A, N)
      END

      SUBROUTINE PREFIX(R, A, N)
        INTEGER N
        REAL R(N), A(N)

        R(1) = A(1)
        DO I = 2, N
          R(I) = R(I - 1) + A(I)
        END DO
      END

      SUBROUTINE CHECKP(R, A, N)
        INTEGER N
        REAL R(N), A(N)

        IF(R(1) .NE. A(1)) THEN
          PRINT *, 'CHECKP: *** error detected !! ***'
        END IF
        DO I = 2, N
          IF(R(I) - R(I - 1) .NE. A(I)) THEN
            PRINT *, 'CHECKP: *** error detected !! ***'
          END IF
        END DO
      END

