Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
engboris committed May 7, 2024
1 parent c6ac447 commit 66bcf1d
Show file tree
Hide file tree
Showing 8 changed files with 282 additions and 3,908 deletions.
19 changes: 16 additions & 3 deletions cobc/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -2519,11 +2519,11 @@ output_strings_states (struct cb_program *prog)
if (strings_used)
output_local ("/* States of string statements */\n");
if (prog->flag_inspect_used)
output_local ("struct cob_inspect_state *inspect_st = NULL;\n");
output_local ("static cob_inspect_state *inspect_st = NULL;\n");
if (prog->flag_string_used)
output_local ("struct cob_string_state *string_st = NULL;\n");
output_local ("static cob_string_state *string_st = NULL;\n");
if (prog->flag_unstring_used)
output_local ("struct cob_unstring_state *unstring_st = NULL;\n");
output_local ("static cob_unstring_state *unstring_st = NULL;\n");
if (strings_used)
output_newline ();
}
Expand Down Expand Up @@ -12871,6 +12871,19 @@ output_internal_function (struct cb_program *prog, cb_tree parameter_list)
output_line ("\tcob_fatal_error (COB_FERROR_CANCEL);");
output_newline ();

if (prog->flag_inspect_used) {
output_line ("if (inspect_st != NULL)");
output_line ("\tcob_free (inspect_st);");
}
if (prog->flag_string_used) {
output_line ("if (string_st != NULL)");
output_line ("\tcob_free (string_st);");
}
if (prog->flag_unstring_used) {
output_line ("if (unstring_st != NULL)");
output_line ("\tcob_free (unstring_st);");
}

if (prog->flag_main) {
goto cancel_end;
}
Expand Down
10 changes: 5 additions & 5 deletions cobc/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -14945,7 +14945,7 @@ examine_format_variant:
break;
case EXAMINE_TAL_UNTIL_FIRST:
r = cb_list_add (r, CB_BUILD_FUNCALL_2 (
"cob_inspect_before_mt",
"cob_inspect_before_r",
current_program->inspect_st_ref,
x
));
Expand All @@ -14970,7 +14970,7 @@ examine_format_variant:
break;
case EXAMINE_TAL_UNTIL_FIRST:
r = cb_list_add (r, CB_BUILD_FUNCALL_2 (
"cob_inspect_before_mt",
"cob_inspect_before_r",
current_program->inspect_st_ref,
x
));
Expand All @@ -14997,7 +14997,7 @@ examine_format_variant:
break;
case EXAMINE_REP_UNTIL_FIRST:
r = cb_list_add (r, CB_BUILD_FUNCALL_2 (
"cob_inspect_before_mt",
"cob_inspect_before_r",
current_program->inspect_st_ref,
from
));
Expand Down Expand Up @@ -15215,7 +15215,7 @@ inspect_before:
BEFORE _initial x
{
$$ = CB_BUILD_FUNCALL_2 (
"cob_inspect_before_mt",
"cob_inspect_before_r",
current_program->inspect_st_ref,
$3
);
Expand All @@ -15226,7 +15226,7 @@ inspect_after:
AFTER _initial x
{
$$ = CB_BUILD_FUNCALL_2 (
"cob_inspect_after_mt",
"cob_inspect_after_r",
current_program->inspect_st_ref,
$3
);
Expand Down
Loading

0 comments on commit 66bcf1d

Please sign in to comment.