https://gcc.gnu.org/g:6a56d7cbb22da365540ca0511d980333e9e35610

commit r17-3878-g6a56d7cbb22da365540ca0511d980333e9e35610
Author: Robert Dubner <[email protected]>
Date:   Wed Sep 2 15:50:59 2026 -0400

    cobol: Repair EXIT PERFORM CYCLE.
    
    Fixes a place where the EXIT PERFORM CYCLE statement was creating a
    GOTO_EXPR where there was no matching LABEL_EXPR.
    
    gcc/cobol/ChangeLog:
    
            * genapi.cc (perform_inline_until): Create testA.label.
            (perform_inline_testafter_varying): Update comment.
            * gengen.cc (gg_append_statement): Update comments.

Diff:
---
 gcc/cobol/genapi.cc |  3 ++-
 gcc/cobol/gengen.cc | 16 +++-------------
 2 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc
index 5bda0cb75cf4..25239d0f641a 100644
--- a/gcc/cobol/genapi.cc
+++ b/gcc/cobol/genapi.cc
@@ -8336,6 +8336,7 @@ perform_inline_until(   struct cbl_perform_tgt_t *tgt,
                   GOTO TOP
       EXIT:
   */
+  gg_append_statement(tgt->addresses.testA.label);
   gg_append_statement(tgt->addresses.test.label);
 
   // Go to where the conditional is recalculated....
@@ -8688,7 +8689,7 @@ perform_inline_testafter_varying(  struct 
cbl_perform_tgt_t *tgt,
   // the list of statements:
   gg_append_statement(tgt->addresses.top.go_to);
 
-  // The list of statements ends with a goto TESTA, and that;s here:
+  // The list of statements ends with a goto TESTA, and that's here:
   gg_append_statement(tgt->addresses.testA.label);
 
   // Build the test section
diff --git a/gcc/cobol/gengen.cc b/gcc/cobol/gengen.cc
index 3f553eebb8a8..479e0e5ba35e 100644
--- a/gcc/cobol/gengen.cc
+++ b/gcc/cobol/gengen.cc
@@ -283,8 +283,8 @@ gg_append_var_decl(tree var_decl)
 
 #define LOOK_FOR_MISSING_LABELS_not
 #ifdef LOOK_FOR_MISSING_LABELS
-static std::set<tree> missing_labels;
-static std::map<tree, int> missing_gotos;
+static std::unordered_set<tree> missing_labels;
+static std::unordered_map<tree, int> missing_gotos;
 void
 dump_missing_labels()
   {
@@ -361,23 +361,13 @@ gg_append_statement(tree stmt)
       }
     else
       {
-        /* computed goto or other expression-valued destination */
+      /* computed goto or other expression-valued destination */
       }
-    //fprintf(stderr,
-    //        "Laying down a GOTO_EXPR  %s %p at line %d\n",
-    //        name_text,
-    //        reinterpret_cast<void *>(label_decl),
-    //        cobol_location().first_line);
     missing_gotos[label_decl] = cobol_location().first_line;
     }
   if( TREE_CODE(stmt) == LABEL_EXPR )
     {
     tree label_decl = LABEL_EXPR_LABEL(stmt);   /* This is a LABEL_DECL. */
-    //fprintf(stderr,
-    //        "Laying down a LABEL_EXPR %s %p at line %d\n",
-    //        name_text,
-    //        reinterpret_cast<void *>(label_decl),
-    //        cobol_location().first_line);
     missing_labels.insert(label_decl);
     }
 #endif

Reply via email to