On Sat, 2025-02-15 at 16:02 -0500, James K. Lowden wrote:
> From 5d53920602e234e4d99ae2d502e662ee3699978e 4 Oct 2024 12:01:22 -
> 0400
> From: "James K. Lowden" <jklow...@symas.com>
> Date: Sat 15 Feb 2025 12:50:53 PM EST
> Subject: [PATCH] 2 new 'cobol' FE files
> 
> gcc/cobol/ChangeLog
>       * genapi.cc: New file.
>       * genapi.h: New file.
> 

+static tree label_list_out_goto;
+static tree label_list_out_label;
+static tree label_list_back_goto;
+static tree label_list_back_label;

Any time we have a static or extern tree, I wonder if it should have a
GTY(()) marker to mark it as a garbage collection root.  Have you
stress-tested this with the params that force a collection on every GC
opportunity?

+static std::map<program_reference_t, std::list<called_tree_t> > call_targets;
+static std::map<tree, cbl_call_convention_t> called_targets;

Similarly here, but the trees in question are deep within global data 
structures that don’t know about the GC.

Hopefully the GC can never run during the times when these structures
are live,otherwise you’ve got problems…


+      IF( left_side, lt_op, gg_cast(TREE_TYPE(left_side), integer_zero_node) )
+        {
+        if( debugging )
+          {
+          gg_printf("normal_normal_compare(): different types returning -1\n",
+                    NULL_TREE);
+          }
+        gg_assign( return_int, integer_minusone_node);
+        }
+      ELSE

What’s with the uppercase IF and ELSE?  Is this just regular control
flow or is some kind of preprocessor magic going on?

+  if( paragraph )
+    {
+    sprintf(ach, "%s", paragraph);
+    strcat(retval, ach);
+    }
+  strcat(retval, ".");
+  if( section )
+    {
+    sprintf(ach, "%s", section);
+    strcat(retval, ach);
+    }
+  strcat(retval, ".");
+  if( mangled_program_name )
+    {
+    strcat(retval, mangled_program_name);
+    }
+  sprintf(ach, ".%ld", current_function->program_id_number);
+  strcat(retval, ach);
+  sprintf(ach, ".%ld", deconflictor);
+  strcat(retval, ach);

“ach” and “retval” are fixed-sized buffers; is all this string
manipulation guaranteed to fit?  Similarly in assembler_label.

+static tree vti_array;
+static tree vti_constructor;

Do these need to be GTY marked?


Dave

Reply via email to