Debian Codegraph @

gcc/testsuite/gfortran.dg/pr119836_2.f90

raw
1 !
2 ! { dg-do compile }
3 !
4 ! PR fortran/119836
5 !
6 ! Although intrinsic functions contained within the Fortran standard
7 ! are pure procedures, many of the additional intrinsic functions
8 ! supplied in libgfortran are impure. RAND() is one such function.
9 !
10 program foo
11 implicit none
12 integer i
13 real x(4)
14 do concurrent (i=1:4)
15 x = rand() ! { dg-error "Reference to impure function" }
16 block
17 x = rand() ! { dg-error "Reference to impure function" }
18 end block
19 end do
20 print *, x
21 end program foo