[PATCH 3/3] sim: m32c: clean up various warnings
Mike Frysinger
vapier@gentoo.org
Sat May 8 00:15:23 GMT 2021
On 07 May 2021 16:27, Simon Marchi wrote:
> On 2021-05-07 12:36 a.m., Mike Frysinger via Gdb-patches wrote:
> > A random grab bag of minor fixes to enable -Werror for this port.
> >
> > Check the return values of read & write calls and issue warnings when
> > they fail.
> > Fixup funky pointer math as the compiler doesn't like ++ on void*.
> > Handle short reads with fread().
>
> I see this with gcc 10:
>
> /home/simark/src/binutils-gdb/sim/m68hc11/dv-m68hc11tim.c: In function ‘cycle_to_string’:
> /home/simark/src/binutils-gdb/sim/m68hc11/dv-m68hc11tim.c:504:26: error: ‘%s’ directive writing up to 31 bytes into a region of size between 13 and 55 [-Werror=format-overflow=]
> 504 | sprintf (buf, "%9lu%s%s", (unsigned long) t, cycle_buf, time_buf);
> | ^~ ~~~~~~~~
> /home/simark/src/binutils-gdb/sim/m68hc11/dv-m68hc11tim.c:504:5: note: ‘sprintf’ output between 10 and 83 bytes into a destination of size 64
> 504 | sprintf (buf, "%9lu%s%s", (unsigned long) t, cycle_buf, time_buf);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
weird ... i'm using gcc-10.2 and i'm not seeing this. what is the full compile
line you're using ? should be easy to fix, but would be nice if i could make
my build extra chatty.
-mike
More information about the Gdb-patches
mailing list