On Sat, 2024-12-14 at 10:11 +0000, Sam James wrote:
> David Malcolm <dmalc...@redhat.com> writes:
> 
> > On Thu, 2024-12-12 at 12:56 -0500, James K. Lowden wrote:

[...]

> > > 
> > > Thank you for your kind consideration of our work.
> > 
> > Please forgive me if you've already said this elsewhere, but is
> > this
> > work available in a public git repo somewhere?
> > 
> 
> https://gitlab.cobolworx.com/COBOLworx/gcc-cobol/
> 
> 

Thanks Sam.  I was able to clone and build from that repo on x86_64-pc-
linux-gnu (building with gcc 10) and have now compiled my first ever
COBOL program!

Caveat: I had to hack up the %require in parse.y since I only have
bison 3.5 (not 3.5.1) on the machine I'm testing it on.

James: does your testing include bootstrap builds?

I got this false positive in the build:

../../src/gcc/cobol/genapi.cc: In function ‘void move_helper(tree,
cbl_refer_t, cbl_refer_t, TREEPLET&, cbl_round_t, bool, bool)’:
../../src/gcc/cobol/genapi.cc:15332:16: warning: ‘st_size’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
15332 |       gg_memcpy(st_data,
      |       ~~~~~~~~~^~~~~~~~~
15333 |                 stash,
      |                 ~~~~~~
15334 |                 st_size);
      |                 ~~~~~~~~
../../src/gcc/cobol/genapi.cc:15332:16: warning: ‘st_data’ may be used
uninitialized in this function [-Wmaybe-uninitialized]

due to my gcc not being smart enough to see that the usage of st_data
and st_size there is guarded by restore_on_error, which also guards the
initialization above.

You may want to apply this trivial fix to placate older C++ compilers:

diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc
index c9f146df41f..af4efcecebb 100644
--- a/gcc/cobol/genapi.cc
+++ b/gcc/cobol/genapi.cc
@@ -15077,8 +15077,8 @@ move_helper(tree size_error,        // This is an INT
 
   static tree stash = gg_define_variable(UCHAR_P, "..mh_stash", 
vs_file_static);
 
-  tree st_data;
-  tree st_size;
+  tree st_data = NULL_TREE;
+  tree st_size = NULL_TREE;
 
   if( restore_on_error )
     {

...since otherwise the build might fail on a bootstrap build (which
IIRC uses -Werror on the later stages).


Taking it for a test-drive; thanks!
Dave

Reply via email to