Skip to content

Commit

Permalink
Merge SVN 4758
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jul 17, 2024
1 parent ba24ef6 commit fbc5b44
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 3 deletions.
1 change: 1 addition & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@
* cobc.c (cobc_abort_terminate): run into libcob provided abort handling
with a default of SIGABRT and a configurable coredump via
COBC_CORE_ON_ERROR overriding COB_CORE_ON_ERROR (currently fixed "2")
* codegen.c (output_call) [COB_NON_ALIGNED]: fix CALL RETURNING

2022-10-08 Simon Sobisch <[email protected]>

Expand Down
6 changes: 3 additions & 3 deletions cobc/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -7032,16 +7032,16 @@ output_call (struct cb_call *p)
}
need_brace = 0;

if (!ret_ptr) {
if (p->call_returning && p->call_returning != cb_null) {
if (p->call_returning && p->call_returning != cb_null) {
if (!ret_ptr) {
if (!need_brace) {
need_brace = 1;
output_block_open ();
}
output_line ("int ret;");
}
#ifdef COB_NON_ALIGNED
else if (dynamic_link) {
else {
if (!need_brace) {
need_brace = 1;
output_block_open ();
Expand Down
57 changes: 57 additions & 0 deletions tests/testsuite.src/run_misc.at
Original file line number Diff line number Diff line change
Expand Up @@ -7369,6 +7369,63 @@ AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], [])
AT_CLEANUP


AT_SETUP([CALL RETURNING POINTER])
AT_KEYWORDS([run_extensions])

AT_DATA([prog.cob], [
identification division.
program-id. prog.

data division.
working-storage section.

01 c-text-pointer usage pointer.

procedure division.

call static "cob_getenv"
using "COB_UNIX_LF"
returning c-text-pointer
end-call

IF function content-of(c-text-pointer) <> "1"
DISPLAY "unexpected value: "
function content-of(c-text-pointer).

GOBACK.
])

AT_DATA([progdyn.cob], [
identification division.
program-id. progdyn.

data division.
working-storage section.

01 c-text-pointer usage pointer.

procedure division.

call "cob_getenv"
using "COB_UNIX_LF"
returning c-text-pointer
end-call

IF function content-of(c-text-pointer) <> "1"
DISPLAY "unexpected value: "
function content-of(c-text-pointer).

GOBACK.
])

AT_CHECK([$COMPILE -fno-gen-c-decl-static-call prog.cob], [0], [], [])
AT_CHECK([$COMPILE progdyn.cob], [0], [], [])
AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], [])
AT_CHECK([$COBCRUN_DIRECT ./progdyn], [0], [], [])

AT_CLEANUP


AT_SETUP([ON EXCEPTION clause of DISPLAY])
AT_KEYWORDS([runmisc exceptions screen])

Expand Down

0 comments on commit fbc5b44

Please sign in to comment.