Oi.  Rainer, I have lost track of when %zu is okay, and when it isn't.  Jim 
has been making adjustments to printf formatting; I haven't been paying 
close attention.  The statement you report came about because I made the 
wrong choice when deconflicting a merge of my stuff and Jim's, and I must 
have chosen the wrong one.

I guess I should discuss this with Jim to get the benefit of his work on 
this.  There must be *some* general solution to the problem of formatting a 
size_t.

As for gcobol.clean...  Jim and I Had Words about this one, so you can know 
that he is on your side.  This is a case where I am not trying to fix the 
world's problems.  I am trying to fix *mine*.  Sometimes I want to be sure 
that I have completely rebuilt all of gcc/cobol and all of libgcobol, but 
without flushing gcc completely, and I want the command to be simple and 
easy to remember.  (The difference is a 13-second build of gcc/cobol and 
libgcobol versus a four-minute complete build of gcc.)

Maybe I should rename it "dubner.clean", or "donotuse.clean".

> -----Original Message-----
> From: Rainer Orth <r...@cebitec.uni-bielefeld.de>
> Sent: Monday, June 30, 2025 10:27
> To: Robert Dubner <rdub...@symas.com>
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [COMMITTED] cobol: Normalize generating and using
> function_decls.
>
> Hi Robert,
>
> > These changes have been shown to generate more sensible code on both
> > x86_64.
> >
> > On x86_64-pc-linux, a bootstrap build of --enable-languages=c,c++,cobol
> > succeeded.
>
> this patch has one change (not listed in ChangeLog) that broke 32-bit
> Solaris bootstrap:
>
> diff --git a/gcc/cobol/parse.y b/gcc/cobol/parse.y
> index f0faaa41577..660b0b4c4c2 100644
> --- a/gcc/cobol/parse.y
> +++ b/gcc/cobol/parse.y
> @@ -12359,7 +12359,7 @@ numstr2i( const char input[], radix_t radix ) {
>      return output;
>    }
>    if( erc == -1 ) {
> -    yywarn("'%s' was accepted as %zu", input, integer);
> +    yywarn("'%s' was accepted as %ld", input, integer);
>    }
>    return output;
>  }
>
> This causes
>
> /vol/gcc/src/hg/master/local/gcc/cobol/parse.y: In function ‘real_value
> numstr2i(const char*, radix_t)’:
> /vol/gcc/src/hg/master/local/gcc/cobol/parse.y:12362:12: error: format
> ‘%ld’ expects argument of type ‘long int’, but argument 3 has type
> ‘std::size_t’ {aka ‘unsigned int’} [-Werror=format=]
> 12362 |     yywarn("'%s' was accepted as %ld", input, integer);
>       |            ^~~~~~~~~~~~~~~~~~~~~~~~~~         ~~~~~~~
>       |                                               |
>       |                                               std::size_t {aka
> unsigned int}
>
> Returning to %zu obviously fixes this.
>
> Besides, I noticed
>
> diff --git a/gcc/cobol/Make-lang.in b/gcc/cobol/Make-lang.in
> index bec81a6acc0..18eb3b0f1e5 100644
> --- a/gcc/cobol/Make-lang.in
> +++ b/gcc/cobol/Make-lang.in
> @@ -353,6 +353,13 @@ cobol.srcman:
>
>  cobol.mostlyclean:
>
> +gcobol.clean:
> +# This is intended for non-general use.  It is a last-ditch effort to
> flush
> +# out all oject files and executable code for gcobol and libgcobol,
> causing
> +# a complete rebuild of all executable code.
> +     rm -fr gcobol cobol1 cobol/*            \
> +     ../*/libgcobol/*
> +
>
> This is at least incomplete: in multilib builds, there are more
> instances of libgcobol in <target triple>/<multilib subdir>/libgcobol.
>
>       Rainer
>
> --
> --------------------------------------------------------------------------
> ---
> Rainer Orth, Center for Biotechnology, Bielefeld University

Reply via email to