N = 2
if( i .LE. N .and. MOD(X(i),10).EQ.2) A= A+B
The above code has worked fine in all past versions. But now using XE2015 it throws an exception when I=3 as it thinks the bounds of X are violated. But it shouldn't need to evaluate the second test as the first will fail. Is there a switch we need to set now for this to not fail? Or do we have to rewrite all the instances of this code to be 2 IF tests?
R.O. has given you a concise answer. In Fortran, expressions can be evaluated in any order, subject to rules regarding parentheses, etc. Therefore, your code should not be written such a way that it depends on a particular order in order to work correctly.
Observe that you are giving mixed arguments (one real, the other integer) to MOD. This should be corrected.
Your code might work (and might even work as expected) if you did not specify bounds checking, but it is not good to tolerate such unstable code.