From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 441 invoked by alias); 21 Oct 2009 14:08:07 -0000 Received: (qmail 395 invoked by uid 48); 21 Oct 2009 14:07:56 -0000 Date: Wed, 21 Oct 2009 14:08:00 -0000 Message-ID: <20091021140756.394.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/41781] [OOP] bogus undefined label error with SELECT TYPE. In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-10/txt/msg01829.txt.bz2 ------- Comment #4 from burnus at gcc dot gnu dot org 2009-10-21 14:07 ------- While for goto 99 if(.true.) then 99 continue end if end one gets (for if, do, select case) the nice warning (!) message: Warning: Label at (1) is not in the same block as the GOTO statement at (2) One gets for goto 99 block 99 continue end block end only: Error: Label 99 referenced at (1) is never defined I think something nicer than "never defined" would be useful. One has also to think about which of those should give a warning (like now) and which should give a hard error. I believe jumping *into* a (DO/IF/SELECT (TYPE/CASE)/BLOCK/ ...) block is invalid, but they are all in the same scoping unit. However, I failed to find this restriction. The standard has: R851 goto-stmt is GO TO label C846 (R851) The label shall be the statement label of a branch target statement that appears in the same scoping unit as the goto-stmt. 1.3.115 scoping unit either - a program unit or subprogram, excluding any scoping units in it, - a derived-type de nition (4.5.2), or - an interface body, excluding any scoping units in it Further restrictions (and some more related to branching to an END only from inside of the ): C734 (R744) A statement that is part of a where-body-construct shall not be a branch target statement. C743 (R756) A forall-body-construct shall not be a branch target. It is permissible to branch to an end-associate-stmt only from within its ASSOCIATE construct. C811 A statement that branches from the block of a critical-construct to outside the critical-construct is not permitted. A CYCLE or EXIT statement in a critical-construct that transfers control outside the critical-construct is not permitted. It is permitted to branch to the end-do of a block DO construct only from within the range of that DO construct. C824 A branch (8.2) within a DO CONCURRENT construct shall not have a branch target that is outside the construct. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41781