> -----Original Message-----
> From: Jakub Jelinek <ja...@redhat.com>
> Sent: Wednesday, March 12, 2025 03:23
> To: Robert Dubner <rdub...@symas.com>
> Cc: Richard Biener <rguent...@suse.de>; Iain Sandoe
> <idsan...@googlemail.com>; GCC Patches <gcc-patches@gcc.gnu.org>;
> jklow...@schemamania.org
> Subject: Re: [PATCH][v3] Simple cobol.dg testsuite
> 
> On Tue, Mar 11, 2025 at 10:06:27PM -0500, Robert Dubner wrote:
> > Earlier in this discussion of a testsuite, the question came up about
> > generating an error return in COBOL source code.
> >
> > In COBOL, "GOBACK ERROR 1." is the equivalent of a C "return 1;".
> > When executed in  the initial "top-level" program-id, it results in
> > the value 1 being passed back to the _start stub.
> >
> > "STOP RUN ERROR 1." is the equivalent of (and is in fact implemented
> > with) "exit(1)".
> 
> Note, in most of the testsuite we try to signal failure from a runtime
> testcase through calling abort (or e.g. fortran STOP N statement).
> On Linux at least when not cross-compiling, exit(1) (or this STOP RUN
> ERROR 1) will work as well, I believe the reason is for some bare metal
> targets which just don't propagate return value from main or exit back
to
> the dejagnu testing framework.
> Does COBOL have something that is implemented as call to abort()?

Jim and I had the design goal of making gcobol object files completely
compatible with other gcc object files, so they can be linked together
without surprises.  There are issues of naming things; COBOL allows for
names with embedded hyphens, and is case-insensitive, and so a complete
answer can be involved.  But that's not important for addressing your
question.

The result is that putting in the COBOL statement 

      CALL "abort".

does just what you'd expect.

So, for that matter, does

      CALL "exit" USING BY VALUE 123.

although that's the same as 

      STOP RUN ERROR 123.

Bob D.

Reply via email to