From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20790 invoked by alias); 20 Jun 2010 20:52:44 -0000 Received: (qmail 20731 invoked by uid 48); 20 Jun 2010 20:52:27 -0000 Date: Sun, 20 Jun 2010 20:52:00 -0000 Message-ID: <20100620205227.20730.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/44602] [F2008] EXIT: Jump to end of construct 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: 2010-06/txt/msg01970.txt.bz2 ------- Comment #1 from burnus at gcc dot gnu dot org 2010-06-20 20:52 ------- See below for a match.c patch. However, it will fail as the labels are not available. In principle, one just needs to add: tree exit_label; /* The exit label. */ exit_label = gfc_build_label_decl (NULL_TREE); code->block->backend_decl = tree_cons (NULL, exit_label, NULL); stmt = build1_v (LABEL_EXPR, exit_label); gfc_add_expr_to_block (&if_se.pre, stmt); to all constructs (in trans-stmt.c) as then trans_exit's exit_label = TREE_VALUE (code->ext.whichloop->backend_decl); would work. However, this fails for instance for the IF block as there "code->block" is only available if an ELSE branch exists. Index: match.c =================================================================== --- match.c (Revision 161045) +++ match.c @@ -2034,6 +2034,13 @@ match_exit_cycle gfc_ascii_statement (st)); return MATCH_ERROR; } + else if (sym == p->sym) + { + if (gfc_notify_std (GFC_STD_F2008, "Fortran 2008: EXIT with no " + "do-construct-name at %C") == FAILURE) + return MATCH_ERROR; + break; + } if (p == NULL) { @@ -2041,7 +2048,7 @@ gfc_error ("%s statement at %C is not within a loop", gfc_ascii_statement (st)); else - gfc_error ("%s statement at %C is not within loop '%s'", + gfc_error ("%s statement at %C is not within construct '%s'", gfc_ascii_statement (st), sym->name); return MATCH_ERROR; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44602