]> git.ipfire.org Git - thirdparty/gcc.git/commit
cobol: Use _perform_line_pairs instead of injecting encoded label names.
authorRobert Dubner <rdubner@symas.com>
Thu, 5 Feb 2026 15:45:40 +0000 (10:45 -0500)
committerRobert Dubner <rdubner@symas.com>
Thu, 5 Feb 2026 20:03:26 +0000 (15:03 -0500)
commit203cbbc22fd8c8ffbc29eb846d8901e4346e95f8
treefa38bc5f39d34d14700ad743aa5cffa652b303aa
parentd78b2b6c01243c59fc52937e1e3b0d84848a8fa9
cobol: Use _perform_line_pairs instead of injecting encoded label names.

The gcobol front end has been communicating with GDB-COBOL by encoding
information into labels that are injected into the assembly language
with ASM_EXPR nodes.  That behavior is, at best, questionable.

These changes replace the "proccall" and "procret" types of those labels
in favor of a static _perform_line_pairs table that contains the same
information and is accessible by GDB-COBOL by virtue of its known name.

That table allows GDB-COBOL to "NEXT over COBOL PERFORM" statements in a
way that is familiar to users who have used "NEXT over function call".

Eventually that information should find its way into the .debug_info
section, but at the present time I don't know how to do that on either
the compiler or debugger sides.

Most of these changes involve eliminating gg_insert_into_assembler calls
and replacing them with the perform_is_armed/perform_line_pairs logic.

Some COBOL variable initialization changes crept in here, as well.

gcc/cobol/ChangeLog:

* genapi.cc (DEFAULT_LINE_NUMBER): Remove unused #define.
(parser_statement_begin): Implement perform_is_armed logic.
(initialize_variable_internal): Handle both real and int types in
SHOW_PARSE tracing.
(section_label): Comment a renumbered insert_nop() for gdb-cobol
logic.
(paragraph_label): Likewise.
(leave_procedure): Eliminate call to gg_insert_into_assembler().
(parser_enter_section): Renumber insert_nop().
(parser_perform): Eliminate call to gg_insert_into_assembler().
(parser_perform_times): Likewise.
(internal_perform_through): Likewise.
(internal_perform_through_times): Likewise.
(parser_leave_file): Create the static _perform_line_pairs table.
(parser_sleep): Renumber insert_nop().
(parser_division): Remove calls to initialize_the_data().
(parser_perform_start): New call to insert_nop().
(parser_perform_conditional): Likewise.
(perform_outofline_before_until): Expanded comment.
(perform_outofline_after_until): Eliminate call to
gg_insert_into_assembler().
(perform_outofline_testafter_varying): Likewise.
(perform_outofline_before_varying): Likewise.
(perform_inline_testbefore_varying):  New call to insert_nop().
(create_and_call): Change a comment.
* gengen.cc (gg_create_goto_pair): Change characteristics of a
label.
* parse.y: Change how data are initialized.
* parse_ante.h (field_type_update): Likewise.
* symbols.cc (cbl_field_t::set_signable): Likewise.
(cbl_field_t::encode): Likewise.
* symbols.h (struct cbl_field_t): Likewise.
* util.cc (symbol_field_type_update): Likewise.
(cbl_field_t::encode_numeric): Likewise.

libgcobol/ChangeLog:

* valconv.cc (__gg__string_to_numeric_edited): Explanatory comment.
gcc/cobol/genapi.cc
gcc/cobol/gengen.cc
gcc/cobol/parse.y
gcc/cobol/parse_ante.h
gcc/cobol/symbols.cc
gcc/cobol/symbols.h
gcc/cobol/util.cc
libgcobol/valconv.cc