https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85599
--- Comment #5 from janus at gcc dot gnu.org --- Here is a variant of the original test case, now with a PURE procedure: program lazy logical :: flag flag = .false. flag = check() .and. flag flag = flag .and. check() contains pure logical function check() check = .true. end function end In this case I would think it's perfectly valid to optimize away both calls to 'check', in particular because there is actually no way to check for the user whether the function 'check' is being called (other than looking at the assembly code etc). However, I could not find any distinctions between pure and impure functions in the standard, when it comes to the question of function evaluation and optimizations. Any pointers appreciated.