Skip to content

Commit

Permalink
Merge SVN 4105, 4108
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jun 13, 2024
1 parent 42ebf2c commit 4388541
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
4 changes: 4 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,10 @@
* cobc.c: --info Displays short (concatenated) list of available
INDEXED file handlers

2020-12-23 Simon Sobisch <[email protected]>

* codegen.c (output_initialize_compound): special handling for OCCURS 1

2020-12-21 Simon Sobisch <[email protected]>

* field.c, pplex.l, tree.c, typeck.c: fixed warning option querying enum
Expand Down
29 changes: 17 additions & 12 deletions cobc/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -6091,13 +6091,18 @@ output_initialize_compound (struct cb_initialize *p, cb_tree x)
cb_tree save_check, save_length, r2;

/* Output initialization for the first record */
output_line ("/* initialize first record for %s */", f->name);
if (f->occurs_max > 1) {
output_line ("/* initialize first record for %s */", f->name);
}

save_length = ref->length;
save_check = ref->check;
/* Output all 'check' first */
for (r2 = ref->check; r2; r2 = CB_CHAIN (r2)) {
output_stmt (CB_VALUE (r2));
}
/* all exceptions would have been raised above,
so temporarily detach from the reference */
ref->check = NULL;
ref->subs = CB_BUILD_CHAIN (cb_int1, ref->subs);
if (type == INITIALIZE_ONE) {
Expand All @@ -6123,17 +6128,17 @@ output_initialize_compound (struct cb_initialize *p, cb_tree x)
}
}

/* all exceptions should have been raised above,
so temporarily detach from the reference */
ref->check = NULL;
ref->length = NULL;

for (pf = f; pf && !pf->flag_occurs_values; pf = pf->parent);
if (pf == NULL
|| !pf->flag_occurs_values) {
output_line ("/* copy initialized record for %s to later occurrences */",
f->name);
propagate_table (c, 1);
if (f->occurs_max > 1) {

ref->length = NULL;

for (pf = f; pf && !pf->flag_occurs_values; pf = pf->parent);
if (pf == NULL
|| !pf->flag_occurs_values) {
output_line ("/* copy initialized record for %s to later occurrences */",
f->name);
propagate_table (c, 1);
}
}

/* restore previous exception-checks for the reference */
Expand Down

0 comments on commit 4388541

Please sign in to comment.