Hi Xi, Jonathan, On 3/16/23 04:17, Xi Ruoyao wrote: > On Wed, 2023-03-15 at 19:06 +0000, Jonathan Wakely via Gcc-help wrote: >> On Wed, 15 Mar 2023, 18:17 Alejandro Colomar via Gcc-help, < >> gcc-help@gcc.gnu.org> 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 > > /* snip */ > >> --disable-werror should work around it. I added that. > > FWIW if you are altering BOOT_CFLAGS, it will be more likely you'll need > --disable-werror than a "plain" build. > > And it seems you are altering BOOT_CFLAGS in a wrong way. AFAIK you > need 'BOOT_CFLAGS="-march=native -O2"' or you are removing the default - > O2 flag. The result will be slower. Hmm, thanks. Then removed that too. And I still get issues. Now it's undefined references. Let me show the commands: $ history [...] 1995 ../configure --with-pkgversion=alx-wusi_1 --prefix=/opt/local/gnu/gcc/wusi/1 --disable-werror --disable-multilib 1996 make bootstrap -j8 1997 touch gcc/c-family/c.opt gcc/c/c-typeck.cc 1998 make bootstrap And here's are the first errors of `make bootstrap`: [...] /home/alx/src/gnu/gcc/.tmp/./prev-gcc/xg++ -B/home/alx/src/gnu/gcc/.tmp/./prev-gcc/ -B/opt/local/gnu/gcc/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/inc lude/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 -no-pie -g -O2 -fchecking=1 -DIN_GCC -fno-exceptions -fno-rtti -f asynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Wconditionally-supported -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadi c-macros -Wno-overlength-strings -fno-common -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-conv ert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-fold.o c/gimple-parser.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-fam ily/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c -ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o i386-c.o glibc-c.o \ cc1-checksum.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ../libbacktrace/.libs/libbacktrace.a .. /libiberty/libiberty.a ../libdecnumber/libdecnumber.a -lmpc -lmpfr -lgmp -rdynamic -L./../zlib -lz -lzstd /usr/bin/ld: c/c-decl.o: in function `warn_if_shadowing(tree_node*)': /home/alx/src/gnu/gcc/.tmp/gcc/../../gcc/c/c-decl.cc:3137: undefined reference to `comptypes(tree_node*, tree_node*)' /usr/bin/ld: c/c-decl.o: in function `warn_if_shadowing': /home/alx/src/gnu/gcc/.tmp/gcc/../../gcc/c/c-decl.cc:3176: undefined reference to `comptypes(tree_node*, tree_node*)' /usr/bin/ld: c/c-decl.o: in function `diagnose_mismatched_decls(tree_node*, tree_node*, tree_node**, tree_node**) [clone .constprop.0]': /home/alx/src/gnu/gcc/.tmp/gcc/../../gcc/c/c-decl.cc:2076: undefined reference to `comptypes_check_enum_int(tree_node*, tree_node*, bool*)' /usr/bin/ld: /home/alx/src/gnu/gcc/.tmp/gcc/../../gcc/c/c-decl.cc:2238: undefined reference to `comptypes_check_different_types(tree_node*, tree_node*, bool*)' /usr/bin/ld: /home/alx/src/gnu/gcc/.tmp/gcc/../../gcc/c/c-decl.cc:1884: undefined reference to `comptypes(tree_node*, tree_node*)' Admittedly, this time I tried already with my patch applied, but I don't think they have any relation with the error. Do you know what might be wrong? Thanks, Alex --- The patch I'm trying is simple: commit 82432cdda2bb968a0dfe8a357ec03cce400ac8f1 (HEAD -> Wunterminated-string-initialization) Author: Alejandro Colomar Date: Wed Mar 15 17:00:15 2023 +0100 Wunterminated-string-initialization diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt index 3333cddeece..0a250593112 100644 --- a/gcc/c-family/c.opt +++ b/gcc/c-family/c.opt @@ -1382,6 +1382,10 @@ Wunsuffixed-float-constants C ObjC Var(warn_unsuffixed_float_constants) Warning Warn about unsuffixed float constants. +Wunterminated-string-initialization +C C++ Var(warn_unterminated_string_initialization) Warning LangEnabledBy(C,Wextra || Wc++-compat) +Warn about character arrays initialized as unterminated strings by a string literal. + Wunused C ObjC C++ ObjC++ LangEnabledBy(C ObjC C++ ObjC++,Wall) ; documented in common.opt diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc index 45bacc06c47..2ae86b247c6 100644 --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -8420,7 +8420,7 @@ digest_init (location_t init_loc, tree type, tree init, tree origtype, pedwarn_init (init_loc, 0, ("initializer-string for array of %qT " "is too long"), typ1); - else if (warn_cxx_compat + else if (warn_unterminated_string_initialization && compare_tree_int (TYPE_SIZE_UNIT (type), len) < 0) warning_at (init_loc, OPT_Wc___compat, ("initializer-string for array of %qT " -- GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5