! { dg-do compile } ! { dg-additional-options "-Wextra" } ! ! PR 85599: warn about short-circuiting of logical expressions for non-pure functions ! ! Contributed by Janus Weil program short_circuit logical :: flag flag = .false. flag = check() .and. flag flag = flag .and. check() ! { dg-warning "might not be evaluated" } flag = flag .and. pure_check() contains logical function check() integer, save :: i = 1 print *, "check", i i = i + 1 check = .true. end function logical pure function pure_check() pure_check = .true. end function end