[committed] cobol: Repair EXIT PERFORM CYCLE.

Message ID 064a01dd3b15$9890c780$c9b25680$@symas.com
State New
Headers
Series [committed] cobol: Repair EXIT PERFORM CYCLE. |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap fail Patch failed to apply
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap fail Patch failed to apply

Commit Message

Robert Dubner Sept. 2, 2026, 7:59 p.m. UTC
  From: Robert Dubner mailto:rdubner@symas.com
Date: Wed, 2 Sep 2026 15:50:59 -0400
Subject: [PATCH] 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.
---
 gcc/cobol/genapi.cc |  3 ++-
 gcc/cobol/gengen.cc | 16 +++-------------
 2 files changed, 5 insertions(+), 14 deletions(-)

 #endif
  

Patch

diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc
index 5bda0cb75cf..25239d0f641 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 3f553eebb8a..479e0e5ba35 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);
     }