https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77710

--- Comment #4 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #3)
> With GCC 7.0.0 20160927 configured with --build=x86_64-pc-linux-gnu
> --host=x86_64-pc-linux-gnu --target=arm-none-eabi I get the expected output
> (below).  I see failures in other tests in the results reported for
> arm-unknown-linux-gnueabihf below but none in the builtin-sprintf-warn-4.c
> test:
> https://gcc.gnu.org/ml/gcc-testresults/2016-09/msg02201.html
> 
> Can you please check again?
> 
> /src/gcc/trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-4.c:10:24:
> warning: writing a terminating nul past the end of the destination
> [-Wformat-length=]
>    sprintf (dst + 7, "%-s", "1");
>                       ~~^~
> /src/gcc/trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-4.c:10:3:
> note: format output 2 bytes into a destination of size 1
>    sprintf (dst + 7, "%-s", "1");
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /src/gcc/trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-4.c:22:22:
> warning: '%-s' directive writing 4 bytes into a region of size 1
> [-Wformat-length=]
>    sprintf (dst + 7, "%-s", "abcd");
>                       ^~~   ~~~~~~
> /src/gcc/trunk/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-4.c:22:3:
> note: format output 5 bytes into a destination of size 1
>    sprintf (dst + 7, "%-s", "abcd");
>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

At r240573 I still get:

% build/gcc/xgcc -v
Using built-in specs.
COLLECT_GCC=build/gcc/xgcc
Target: arm-none-eabi
Configured with: src/configure --prefix=install --target=arm-none-eabi
--enable-languages=c,c++ --with-cpu=cortex-m0 --with-mode=thumb --with-newlib
--with-headers=src/newlib/libc/include --enable-newlib-register-fini
--disable-newlib-supplied-syscalls --disable-multilib --with-libexpat
--with-system-zlib --disable-gdbtk --enable-plugins --disable-libgomp
--disable-libmudflap --disable-libquadmath --disable-libssp
--disable-libstdcxx-pch --disable-nls --disable-rda --disable-sid --disable-tui
--disable-utils --disable-werror --disable-fixed-point 
Thread model: single
gcc version 7.0.0 20160928 (experimental) (GCC)

% grep -A 2 FAIL build/gcc/testsuite/gcc/gcc.logFAIL:
gcc.dg/tree-ssa/builtin-sprintf-warn-4.c (test for excess errors)
Excess errors:
src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-4.c:10:24: warning:
writing a terminating nul past the end of the destination
[-Wformat-length=]src/gcc/testsuite/gcc.dg/tree-ssa/builtin-sprintf-warn-4.c:22:22:
warning: '%-s' directive writing 4 bytes into a region of size 1
[-Wformat-length=]

I'll try to investigate myself since it is difficult to reproduce it for you.

Best regards,

Thomas

Reply via email to