On Thu, Jul 31, 2025 at 11:02:20PM +0200, Rainer Orth via Gcc wrote:
> Hi Jonathan,
> 
> > On Thu, 31 Jul 2025, 22:44 Jonathan Wakely, <jwakely....@gmail.com> wrote:
> >
> >>
> >>
> >> On Thu, 31 Jul 2025, 22:23 James K. Lowden, <jklow...@cobolworx.com>
> >> wrote:
> >>
> >>> I want to understand what our baseline is wrt %z in diagnostic
> >>> messages.  The proximate cause is this change on July 11 for 32-bit
> >>> Darwin to gcc/cobol/parse.y:
> >>>
> >>>    error_msg(loc, "FUNCTION %qs has "
> >>> -            "inconsistent parameter type %zu (%qs)",
> >>> -            keyword_str($1), p - args.data(), name_of(p->field) );
> >>>
> >>
> >> This code is just wrong. %zu expects size_t but the argument is ptrdiff_t
> >>
> >
> > You could cast the argument to size_t to make it correct, or cast it to
> > some other known type such as long, and then use the corresponding
> > specifier such was %ld, which seems to be what the change did.
> 
> this was all described in excruciating detail in the patch submission
> 
>       https://gcc.gnu.org/pipermail/gcc-patches/2025-June/687385.html
> 
> and the commit message.

Looking at that patch, the dbgmsg change looks correct (dbgmsg is
ATTRIBUTE_PRINTF_1), while the last 3 hunks are suboptimal, they should
really use %td and keep the ptrdiff_t arguments without casts.

        Jakub

Reply via email to