Re: Error building gcc master: gcc/opts.cc: -Werror=format-truncation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 15 Mar 2023, 18:17 Alejandro Colomar via Gcc-help, <
gcc-help@xxxxxxxxxxx> wrote:

> Hi,
>
> I'm getting this error while building GCC from the master branch:
>
> alx@debian:~/src/gnu/gcc/.tmp$ make 'BOOT_CFLAGS=-march=native' bootstrap
> [...]
> /home/alx/src/gnu/gcc/.tmp/./prev-gcc/xg++
> -B/home/alx/src/gnu/gcc/.tmp/./prev-gcc/
> -B/opt/gnu/gcc/alx/Wusi/1/x86_64-pc-linux-gnu/bin/ -nostdinc++
> -B/home/alx/src/gnu/gcc/.tmp/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
> -B/home/alx/src/gnu/gcc/.tmp/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs
> -I/home/alx/src/gnu/gcc/.tmp/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu
> -I/home/alx/src/gnu/gcc/.tmp/prev-x86_64-pc-linux-gnu/libstdc++-v3/include
> -I/home/alx/src/gnu/gcc/libstdc++-v3/libsupc++
> -L/home/alx/src/gnu/gcc/.tmp/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
> -L/home/alx/src/gnu/gcc/.tmp/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs
> -fno-PIE -c   -march=native -fno-checking -gtoggle -DIN_GCC
>  -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall
> -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute
> -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long
> -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common
> -DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include
> -I../../gcc/../libcpp/include -I../../gcc/../libcody
> -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/bid
> -I../libdecnumber -I../../gcc/../libbacktrace   -o opts.o -MT opts.o -MMD
> -MP -MF ./.deps/opts.TPo ../../gcc/opts.cc
> ../../gcc/opts.cc: In function ‘void print_filtered_help(unsigned int,
> unsigned int, unsigned int, unsigned int, gcc_options*, unsigned int)’:
> ../../gcc/opts.cc:1685:26: error: ‘  ’ directive output may be truncated
> writing 2 bytes into a region of size between 1 and 256
> [-Werror=format-truncation=]
>  1685 |                       "%s  %s", help, _(use_diagnosed_msg));
>       |                          ^~
> ../../gcc/opts.cc:1684:22: note: ‘snprintf’ output 3 or more bytes
> (assuming 258) into a destination of size 256
>  1684 |             snprintf (new_help, sizeof new_help,
>       |             ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
>  1685 |                       "%s  %s", help, _(use_diagnosed_msg));
>       |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1plus: all warnings being treated as errors
> make[3]: *** [Makefile:1152: opts.o] Error 1
>
>
> My system is Debian Sid, and GCC 12.2.0:
> $ gcc --version
> gcc (Debian 12.2.0-14) 12.2.0
> Copyright (C) 2022 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>
> Is it some known issue?  I was trying to test a patch I'm developing,
> but I can't even build from master.
>


--disable-werror should work around it.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux