On Tue, 11 Mar 2025, 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)".

Thanks, I'll add a fail.cob test checking this is catched by dejagnu.

Richard.

> Bob D.
> 
> > -----Original Message-----
> > From: Jakub Jelinek <ja...@redhat.com>
> > Sent: Tuesday, March 11, 2025 11:27
> > To: Richard Biener <rguent...@suse.de>
> > Cc: Iain Sandoe <idsan...@googlemail.com>; GCC Patches <gcc-
> > patc...@gcc.gnu.org>; jklow...@schemamania.org
> > Subject: Re: [PATCH][v3] Simple cobol.dg testsuite
> > 
> > On Tue, Mar 11, 2025 at 04:18:32PM +0100, Richard Biener wrote:
> > > On Tue, 11 Mar 2025, Jakub Jelinek wrote:
> > >
> > > > On Tue, Mar 11, 2025 at 02:45:33PM +0000, Iain Sandoe wrote:
> > > > > > The following incremental patch does this.  The result has
> > > > > > everything needed but also some weird entries:
> > > > > >
> > > > > > Setting LD_LIBRARY_PATH to
> > > > > > .:/tmp/obj/x86_64-pc-linux-gnu/./libgcobol/.libs:/tmp/obj/x86_64
> > > > > > -pc-linux-gnu/./libstdc++-v3/src/.libs:/tmp/obj/gcc/testsuite/co
> > > > > > bol/../..:/tmp/obj/gcc/testsuite/cobol/../../32:.:/tmp/obj/x86_6
> > > > > > 4-pc-linux-gnu/./libgcobol/.libs:/tmp/obj/x86_64-pc-linux-gnu/./
> > > > > > libstdc++-v3/src/.libs:/tmp/obj/gcc/testsuite/cobol/../..:/tmp/o
> > > > > > bj/gcc/testsuite/cobol/../../32
> > > > > >
> > > > > > Richard.
> > > > > >
> > > > > >
> > > > > > diff --git a/gcc/testsuite/lib/cobol.exp
> > > > > > b/gcc/testsuite/lib/cobol.exp index 65687bc64ae..73dfeab5ba8
> > > > > > 100644
> > > > > > --- a/gcc/testsuite/lib/cobol.exp
> > > > > > +++ b/gcc/testsuite/lib/cobol.exp
> > > > > > @@ -119,6 +119,9 @@ proc cobol_link_flags { paths } {
> > > > > >        }
> > > > > >        append ld_library_path ":${gccpath}/libgcobol/.libs"
> > > > > >       }
> > > > > > +      if { [file exists
> > > > > > "${gccpath}/libstdc++-v3/src/.libs/libstdc++.${shlib_ext}"] } {
> > > > >
> > > > > I think Darwin at least, will need a -B for the
> > > > > libstdc++-v3/src/.libs path adding to the flags; this is used to
> > > > > set the embedded runpaths and the OS is getting picky about not
> > falling back to alternate shared libs.
> > > > > (not any way urgent since we cannot build the FE yet)
> > > >
> > > > Yeah, I'd just add -B with libstdc++-src-v3/src/.libs on all targets
> > > > too, not just the ld_library_path part.
> > >
> > > Fair enough, then additionally the following
> > >
> > > diff --git a/gcc/testsuite/lib/cobol.exp b/gcc/testsuite/lib/cobol.exp
> > > index 73dfeab5ba8..cd88bcb66d1 100644
> > > --- a/gcc/testsuite/lib/cobol.exp
> > > +++ b/gcc/testsuite/lib/cobol.exp
> > > @@ -119,7 +119,13 @@ proc cobol_link_flags { paths } {
> > >         }
> > >         append ld_library_path ":${gccpath}/libgcobol/.libs"
> > >        }
> > > -      if { [file exists
> > > "${gccpath}/libstdc++-v3/src/.libs/libstdc++.${shlib_ext}"] } {
> > > +      if { [file exists
> > > + "${gccpath}/libstdc++-v3/src/.libs/libstdc++.a"]
> > > ||
> > > +          [file exists
> > > "${gccpath}/libstdc++-v3/src/.libs/libstdc++.${shlib_ext}"] } {
> > > +       if { $target_wants_B_option } {
> > > +          append flags "-B${gccpath}/libstdc++-v3/src/.libs "
> > > +       } else {
> > > +          append flags "-L${gccpath}/libstdc++-v3/src/.libs "
> > > +       }
> > >         append ld_library_path ":${gccpath}/libstdc++-v3/src/.libs"
> > >        }
> > >
> > 
> > Looks good to me.
> > 
> >     Jakub
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)

Reply via email to