Build failure due to format-truncation

Martin Sebor
Fri Jun 18 00:05:36 GMT 2021

On 6/17/21 5:04 PM, José Rui Faustino de Sousa wrote:
> On 17/06/21 20:51, Martin Sebor wrote:
>> What stage does this happens in, and if stage 1, what is the system 
>> compiler? 
>  >
> I am not sure if this happens also in the earlier stages, I would have 
> to do a complete rebuild and that would take some time.
> I have built gcc using an altered "opts.c" so that it compiles without 
> problems. After that replacing the file with the original one generates 
> the error. So this is happening at the later stages of compilation.
>> You need GCC 12 to reproduce it and as far as I can see
>> it needs -O0 (or -Og or -Os). 
>  >
> No problems with 11, 10 or 9, with the same flags.
>> That seems like a unique setup.  If
>> this is stage 1 it doesn't use -Werror so warnings shouldn't keep
>> the build from succeeding.  If some later stage and you're using
>> any unusual options (like -Og or -Os) then that would also be
>> unusual.  Otherwise I'll need more info to understand what's going
>> on.
> This is the full command issued by make:
> /home/jrfsousa/Work/gcc/build-master/./prev-gcc/xg++ 
> -B/home/jrfsousa/Work/gcc/build-master/./prev-gcc/ 
> -B/opt/gcc/gcc-master/x86_64-pc-linux-gnu/bin/ -nostdinc++ 
> -B/home/jrfsousa/Work/gcc/build-master/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs 
> -B/home/jrfsousa/Work/gcc/build-master/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs 
> -I/home/jrfsousa/Work/gcc/build-master/prev-x86_64-pc-linux-gnu/libstdc++-v3/include/x86_64-pc-linux-gnu 
> -I/home/jrfsousa/Work/gcc/build-master/prev-x86_64-pc-linux-gnu/libstdc++-v3/include 
>   -I/home/jrfsousa/Work/gcc/gcc-master/libstdc++-v3/libsupc++ 
> -L/home/jrfsousa/Work/gcc/build-master/prev-x86_64-pc-linux-gnu/libstdc++-v3/src/.libs 
> -L/home/jrfsousa/Work/gcc/build-master/prev-x86_64-pc-linux-gnu/libstdc++-v3/libsupc++/.libs 
>   -fno-PIE -c   -O0 -g3 -ggdb3 -gdwarf-4 -fvar-tracking-assignments 

Right, with -O0 we understand why it happens.  So you must have set
CXXFLAGS to -O0 (you might have said that and I forgot; if so, sorry
if I sent you on a wild goose chase). That's also the unusual part
and why others haven't run into it.  Normally stage 2 and later build
with -O2 or higher.

Does that make sense?


> -fno-omit-frame-pointer -fstrict-overflow -fstack-check   -fchecking=1 
> -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W 
> -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag 
> -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long 
> -Wno-variadic-macros -Wno-overlength-strings -Werror -fno-common 
> -DHAVE_CONFIG_H -I. -I. -I../../gcc-master/gcc -I../../gcc-master/gcc/. 
> -I../../gcc-master/gcc/../include 
> -I../../gcc-master/gcc/../libcpp/include 
> -I../../gcc-master/gcc/../libcody 
> -I/home/jrfsousa/Work/gcc/build-master/./gmp 
> -I/home/jrfsousa/Work/gcc/gcc-master/gmp 
> -I/home/jrfsousa/Work/gcc/build-master/./mpfr/src 
> -I/home/jrfsousa/Work/gcc/gcc-master/mpfr/src 
> -I/home/jrfsousa/Work/gcc/gcc-master/mpc/src 
> -I../../gcc-master/gcc/../libdecnumber 
> -I../../gcc-master/gcc/../libdecnumber/bid -I../libdecnumber 
> -I../../gcc-master/gcc/../libbacktrace 
> -I/home/jrfsousa/Work/gcc/build-master/./isl/include 
> -I/home/jrfsousa/Work/gcc/gcc-master/isl/include  -o opts.o -MT opts.o 
> -MMD -MP -MF ./.deps/opts.TPo ../../gcc-master/gcc/opts.c
> Applying the command by hand still fails, with or without the flags I 
> used (-O0 -g3 -ggdb3 -gdwarf-4 -fvar-tracking-assignments 
> -fno-omit-frame-pointer -fstrict-overflow -fstack-check), after removing 
> "-Wall" the compilation succeeds without problems.
> Thank you very much.
> Best regards,
> José Rui

More information about the Gcc mailing list