------- Comment #5 from mimo2 at free dot fr 2007-03-20 08:56 ------- OK but in the present situation, the execution could be different wether you have -fbounds-check or not. Let's change the code by program toto implicit none real :: a(100) integer :: i, k a(:) = 1. do i=1,100 if( i <= 10 .and. a(k(i)) > 0. ) write(*,*) i,a(i) enddo end which is perfectly legitimate, and with k(i) a function. I've understood that when i>10, k will not be called when no bound-checking (there is presently short-circuit) while it will be called if bound checking. As k(i) may have some side effects, this could lead to different execution path. I still think that having a consistent behaviour between the two options is the right thing to do. As short-circuit seems to be an extension of the standard, the most sensible way would be to have an additionnal flag -short-circuit which would allow the user to choose if he wants it or not, and that this flag apply to all situations (i.e. bound-checking or not).
-- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31269