I don't suppose this could be called a compiler bug; more a blind spot. The following code is a heavily-stripped down version of a routine I was hacking around yesterday.
program unspotted_no_op
integer trys, dsa, numdsa
logical test (4)
numdsa = 10
test = .true.
outer_loop: do dsa = 1, numdsa
trys = 0
inner_loop: do
trys = trys + 1
if (test (1)) then
if (test (2)) cycle outer_loop
if (test (3)) cycle inner_loop
exit outer_loop
end if
end do inner_loop
if (test (4)) exit outer_loop
end do outer_loop
stop
end program unspotted_no_op
When compiled with /RELEASE, FTN95 correctly issues:
warning 133 - This statement will never be executed
in respect of the line:
if (test (4)) exit outer_loop
When compiled with /DEBUG or /CHECKMATE, however, FTN95 fails to spot that anything is or amiss (or fails to mention the fact).
I'm glad I investigated this because my first thought was that the RELEASE build was issuing a false positive. In fact, it was quite correct in identifying something that was definitely not the design intent, and which I'd never have spotted in the original code.