------- Comment #1 from kargl at gcc dot gnu dot org 2008-12-12 17:42 ------- Not only do I agree that warning is bogus, I think we get it wrong even with END IF. From Annex B,
(2) Branching to an END IF statement from outside its block. In Fortran 77, and for consistency also in Fortran 90, it was possible to branch to an END IF statement from outside the IF construct; this has been deleted. A similar result can be achieved by branching to a CONTINUE statement that is immediately after the END IF statement. Notice the "from outside its block" and consider program a i = 1 goto 1 ! No warning? Outside of if-then-endif block if (i == 1) then goto 1 ! Warning issued? print *, i 1 end if end program a -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38507