Skip to content

Commit

Permalink
fixing [bugs:#777] undeclared variable with REDEFINE GLOBAL
Browse files Browse the repository at this point in the history
cobc/codegen.c (output_base): fix undeclared variable with REDEFINE GLOBAL

(On behalf of Samuel Belondrade <[email protected]>)
  • Loading branch information
nberth committed Dec 15, 2022
1 parent bde2064 commit a296109
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
5 changes: 5 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,11 @@
* tree.c: fix bug #772 check for report field missing PIC
when using SUM clause

2021-12-21 Samuel Belondrade <[email protected]>

* codegen.c (output_base): fix undeclared variable with REDEFINE GLOBAL
[bugs:#777]

2021-12-14 Simon Sobisch <[email protected]>

* cobc.c (print_fields), codegen.c (output_field_display): only check for
Expand Down
2 changes: 1 addition & 1 deletion cobc/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ output_base (struct cb_field *f, const cob_u32_t no_output)
bl = cobc_parse_malloc (sizeof (struct base_list));
bl->f = f01;
bl->curr_prog = excp_current_program_id;
if (f01->flag_is_global ||
if (f01->flag_is_global || f->flag_is_global ||
current_prog->flag_file_global) {
bl->next = base_cache;
base_cache = bl;
Expand Down
19 changes: 19 additions & 0 deletions tests/testsuite.src/run_fundamental.at
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,25 @@ AT_CHECK([$COBCRUN_DIRECT ./prog], [0],
AT_CLEANUP


AT_SETUP([GLOBAL REDEFINES])
AT_KEYWORDS([fundamental])

AT_DATA([prog.cob], [
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 T0 PIC X VALUE "X".
01 T1 REDEFINES T0 PIC X GLOBAL.
PROCEDURE DIVISION.
DISPLAY T1.
])

AT_CHECK([$COMPILE prog.cob], [0], [], [])

AT_CLEANUP


AT_SETUP([function with variable-length RETURNING item])
AT_KEYWORDS([fundamental udf])

Expand Down

0 comments on commit a296109

Please sign in to comment.