Skip to content

Commit

Permalink
Fix INDEXED BY in LINKAGE SECTION
Browse files Browse the repository at this point in the history
Fix a bug where INDEXED BY in LINKAGE SECTION would cause the variable
not to be added to the local include file, causing a compile error of
the C code.
  • Loading branch information
lefessan committed Jan 6, 2025
1 parent f684913 commit e259ff7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

2025-01-06 Fabrice Le Fessant <[email protected]>

* parser.y (rule occurs_index): set index_type to CB_INT_INDEX
also for INDEXED BY appaering in LINKAGE SECTION, otherwise
the variable is not added to the local include file

2025-01-03 Fabrice Le Fessant <[email protected]>

* typeck.c (build_evaluate, cb_check_needs_break): fix a bug where
Expand Down
3 changes: 2 additions & 1 deletion cobc/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -8569,7 +8569,8 @@ occurs_index:
const cb_tree init_val = cb_default_byte == CB_DEFAULT_BYTE_INIT
? cb_int1 : NULL;
$$ = cb_build_index ($1, init_val, 1U, current_field);
if (storage == CB_STORAGE_LOCAL) {
if (storage == CB_STORAGE_LOCAL ||
storage == CB_STORAGE_LINKAGE) {
CB_FIELD_PTR ($$)->index_type = CB_INT_INDEX;
} else {
CB_FIELD_PTR ($$)->index_type = CB_STATIC_INT_INDEX;
Expand Down

0 comments on commit e259ff7

Please sign in to comment.