Debian Codegraph @

gcc/testsuite/gfortran.dg/short_circuiting_2.f90

raw
1 ! { dg-do run }
2 ! { dg-options "-O0" }
3 !
4 ! PR 57160: short-circuit IF only with -ffrontend-optimize
5 !
6 ! this checks that short-circuiting is not done with -O0
7 !
8 ! Contributed by Janus Weil <[email protected]>
9
10 program short_circuit
11
12 integer, save :: i = 0
13 logical :: flag
14
15 flag = .false.
16 flag = check() .and. flag
17 flag = flag .and. check()
18
19 if (i /= 2) stop 1
20
21 contains
22
23 logical function check()
24 i = i + 1
25 check = .true.
26 end function
27
28 end