* tree-cfg.c (tree_verify_flow_info): Check that a nonlocal
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Jan 2005 22:39:41 +0000 (22:39 +0000)
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 20 Jan 2005 22:39:41 +0000 (22:39 +0000)
label is first in a sequence of labels.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@93993 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-cfg.c

index 07b5d87..be4bfdd 100644 (file)
@@ -1,3 +1,8 @@
+2005-01-20  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * tree-cfg.c (tree_verify_flow_info): Check that a nonlocal
+       label is first in a sequence of labels.
+
 2005-01-20  Janis Johnson  <janis187@us.ibm.com>
            Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
index 5321fa4..e7abf97 100644 (file)
@@ -3595,25 +3595,38 @@ tree_verify_flow_info (void)
     {
       bool found_ctrl_stmt = false;
 
+      stmt = NULL_TREE;
+
       /* Skip labels on the start of basic block.  */
       for (bsi = bsi_start (bb); !bsi_end_p (bsi); bsi_next (&bsi))
        {
-         if (TREE_CODE (bsi_stmt (bsi)) != LABEL_EXPR)
+         tree prev_stmt = stmt;
+
+         stmt = bsi_stmt (bsi);
+
+         if (TREE_CODE (stmt) != LABEL_EXPR)
            break;
 
-         if (label_to_block (LABEL_EXPR_LABEL (bsi_stmt (bsi))) != bb)
+         if (prev_stmt && DECL_NONLOCAL (LABEL_EXPR_LABEL (stmt)))
+           {
+             error ("Nonlocal label %s is not first "
+                    "in a sequence of labels in bb %d"",
+                    IDENTIFIER_POINTER (DECL_NAME (LABEL_EXPR_LABEL (stmt))),
+                    bb->index);
+             err = 1;
+           }
+
+         if (label_to_block (LABEL_EXPR_LABEL (stmt)) != bb)
            {
-             tree stmt = bsi_stmt (bsi);
              error ("Label %s to block does not match in bb %d\n",
                     IDENTIFIER_POINTER (DECL_NAME (LABEL_EXPR_LABEL (stmt))),
                     bb->index);
              err = 1;
            }
 
-         if (decl_function_context (LABEL_EXPR_LABEL (bsi_stmt (bsi)))
+         if (decl_function_context (LABEL_EXPR_LABEL (stmt))
              != current_function_decl)
            {
-             tree stmt = bsi_stmt (bsi);
              error ("Label %s has incorrect context in bb %d\n",
                     IDENTIFIER_POINTER (DECL_NAME (LABEL_EXPR_LABEL (stmt))),
                     bb->index);