[Bug c/41989] New: Code optimized for AMD Geode is slower than generic
I noticed that when compiling with -march=geode the code is actually slower than the one generated with generic options (i386 or i686). This happens with any program, not just with dhrystone # CFLAGS='-march=i386' ./dry.c Dhrystones per Second: 643501 # CFLAGS='-march=i486' ./dry.c Dhrystones per Second: 712251 # CFLAGS='-march=i586' ./dry.c Dhrystones per Second: 711238 # CFLAGS='-march=i686' ./dry.c Dhrystones per Second: 878735 # CFLAGS='-march=geode' ./dry.c Dhrystones per Second: 684932 -- Summary: Code optimized for AMD Geode is slower than generic Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rootkit85 at yahoo dot it http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug c/41989] Code optimized for AMD Geode is slower than generic
--- Comment #1 from rootkit85 at yahoo dot it 2009-11-08 18:51 --- Created an attachment (id=18994) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18994&action=view) the dhrystone benchmark -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug target/41989] Code optimized for AMD Geode is slower than generic
--- Comment #4 from rootkit85 at yahoo dot it 2009-11-08 19:52 --- # cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 5 model : 10 model name : Geode(TM) Integrated Processor by AMD PCS stepping: 2 cpu MHz : 498.060 cache size : 128 KB fdiv_bug: no hlt_bug : no f00f_bug: no coma_bug: no fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu de pse tsc msr cx8 sep pge cmov clflush mmx mmxext 3dnowext 3dnow bogomips: 996.12 clflush size: 32 cache_alignment : 32 address sizes : 32 bits physical, 32 bits virtual power management: # CFLAGS='-march=native' ./dry.c Dhrystones per Second: 715308 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug target/41989] Code optimized for AMD Geode is slower than generic
--- Comment #6 from rootkit85 at yahoo dot it 2009-11-08 22:34 --- (In reply to comment #5) > Subject: Re: Code optimized for AMD Geode is slower than generic > > > > Sent from my iPhone > > On Nov 8, 2009, at 11:52 AM, "rootkit85 at yahoo dot it" > > wrote: > > > > > > > --- Comment #4 from rootkit85 at yahoo dot it 2009-11-08 19:52 > > --- > > # cat /proc/cpuinfo > > processor : 0 > > vendor_id : AuthenticAMD > > cpu family : 5 > > model : 10 > > model name : Geode(TM) Integrated Processor by AMD PCS > > stepping: 2 > > cpu MHz : 498.060 > > cache size : 128 KB > > fdiv_bug: no > > hlt_bug : no > > f00f_bug: no > > coma_bug: no > > fpu : yes > > fpu_exception : yes > > cpuid level : 1 > > wp : yes > > flags : fpu de pse tsc msr cx8 sep pge cmov clflush mmx > > mmxext > > 3dnowext 3dnow > > Since it has cmov this is not a real geode :). What has to do CMOV with Geode? It isn't an Athlon: # CFLAGS='-march=k6' ./dry.c Dhrystones per Second: 757576 # CFLAGS='-march=athlon' ./dry.c Dhrystones per Second: 764526 # CFLAGS='-march=athlon-xp' ./dry.c Dhrystones per Second: 758725 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug target/41989] Code optimized for AMD Geode is slower than generic
--- Comment #8 from rootkit85 at yahoo dot it 2009-11-09 08:55 --- 1) define "real geode" 2) what CPU do I have? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug target/41989] Code optimized for AMD Geode is slower than generic
--- Comment #9 from rootkit85 at yahoo dot it 2009-11-09 09:01 --- Read here pag. 15: http://www.amd.com/files/connectivitysolutions/geode/geode_lx/33234F_LX_databook.pdf "The instruction set supported by the core is a combination of Intel Pentium® processor, AMD Athlon processor, and AMD Geode LX processor specific instructions. Specifi- cally, it supports the Pentium, Pentium Pro, AMD 3DNow! technology and MMX instructions for the AMD Athlon processor. It supports a subset of the specialized AMD Geode LX processor instructions including special SMM instructions. The CPU Core does not support the entire Katmai New Instruction (KNI) set as implemented in the Pentium 3. It does support the MMX instructions for the AMD Athlon processor, which are a subset of the Pentium 3 KNI instructions." -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug target/41989] Code optimized for AMD Geode is slower than generic
--- Comment #16 from rootkit85 at yahoo dot it 2009-11-09 13:17 --- Yes, it seems that even old Geode has such instructions: # cat /proc/cpuinfo processor : 0 vendor_id : Geode by NSC cpu family : 5 model : 9 model name : Unknown stepping: 1 cpu MHz : 266.688 fdiv_bug: no hlt_bug : no f00f_bug: no coma_bug: no fpu : yes fpu_exception : yes cpuid level : 2 wp : yes flags : fpu tsc msr cx8 cmov mmx cxmmx bogomips: 534.07 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug target/41989] Code optimized for AMD Geode is slower than generic
--- Comment #18 from rootkit85 at yahoo dot it 2009-11-09 15:26 --- As I did here? http://patchwork.kernel.org/patch/51410/ -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug target/41989] Code optimized for AMD Geode is slower than generic
--- Comment #20 from rootkit85 at yahoo dot it 2009-11-09 20:25 --- Yes K6 is the best fallback for geode-lx, while pentium-mmx is the best one for geode. I need to know if this new -march argument will be added so I edit the kernel patch. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug target/41989] Code optimized for AMD Geode is slower than generic
--- Comment #21 from rootkit85 at yahoo dot it 2009-11-09 21:59 --- Created an attachment (id=19001) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=19001&action=view) A patch which adds Geode LX support to GCC -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug target/41989] Code optimized for AMD Geode is slower than generic
--- Comment #23 from rootkit85 at yahoo dot it 2009-11-16 10:02 --- Despite its name Geode GX, LX and NX are very different, I guess that we should split them to geode-gx and geode-lx, and alias geode-nx to k7 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug c/48546] New: lto-wrapper returned 1 exit
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48546 Summary: lto-wrapper returned 1 exit Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: rootki...@yahoo.it I tried to compile a kernel module with LTO but the compiler died when linking: gcc -flto -nostdlib -nodefaultlibs -r -Wl,-m -Wl,elf_x86_64 -Wl,-T/usr/src/linux-2.6.38/scripts/module-common.lds -Wl,--build-id -o /home/matteo/Downloads/compat-wireless-2011-03-31/drivers/net/wireless/ath/ath9k/ath9k.i /home/matteo/Downloads/compat-wireless-2011-03-31/drivers/net/wireless/ath/ath9k/ath9k.o /home/matteo/Downloads/compat-wireless-2011-03-31/drivers/net/wireless/ath/ath9k/ath9k.mod.o lto1: internal compiler error: Errore di segmentazione Please submit a full bug report, with preprocessed source if appropriate. See for instructions. lto-wrapper: /usr/bin/gcc returned 1 exit status collect2: lto-wrapper returned 1 exit status
[Bug c/48546] lto-wrapper returned 1 exit
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48546 --- Comment #2 from rootkit85 at yahoo dot it 2011-04-11 13:48:52 UTC --- I'll try when Linaro will switch to 4.6 then
[Bug target/41989] Code optimized for AMD Geode is slower than generic
--- Comment #25 from rootkit85 at yahoo dot it 2010-08-22 13:34 --- try -march=i686 it should be the best -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug target/41989] Code optimized for AMD Geode is slower than generic
--- Comment #27 from rootkit85 at yahoo dot it 2010-08-31 18:02 --- you could try but i'm not sure that NOPL is mandatory for the i686 arch -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41989
[Bug c/46536] New: ICE when compiling ARM kernel
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46536 Summary: ICE when compiling ARM kernel Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: rootki...@yahoo.it I get this when compiling an Android ARM kernel: arm-eabi-gcc -Wp,-MD,mm/.page-writeback.o.d -nostdinc -mlittle-endian -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -marm -mabi=aapcs-linux -mno-thumb-interwork -funwind-tables -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -c -o mm/page-writeback.o mm/page-writeback.imm/page-writeback.c: In function 'write_cache_pages': mm/page-writeback.c:820: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. --- Comment #1 from rootkit85 at yahoo dot it 2010-11-18 11:25:06 UTC --- Created attachment 22442 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=22442 the preprocessed source file
[Bug c/46536] ICE when compiling ARM kernel
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46536 rootki...@yahoo.it changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||DUPLICATE --- Comment #3 from rootkit85 at yahoo dot it 2010-11-18 12:52:31 UTC --- duplicate of #45102 *** This bug has been marked as a duplicate of bug 45102 ***
[Bug target/45102] mm/page-writeback.c:820: internal compiler error: Segmentation fault
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45102 rootki...@yahoo.it changed: What|Removed |Added CC||rootkit85 at yahoo dot it --- Comment #5 from rootkit85 at yahoo dot it 2010-11-18 12:52:31 UTC --- *** Bug 46536 has been marked as a duplicate of this bug. ***
[Bug c/34682] 70% slowdown with SSE enabled
--- Comment #1 from rootkit85 at yahoo dot it 2008-01-05 21:31 --- Created an attachment (id=14882) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14882&action=view) the source -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34682
[Bug c/34682] 70% slowdown with SSE enabled
--- Comment #2 from rootkit85 at yahoo dot it 2008-01-05 21:31 --- Created an attachment (id=14883) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14883&action=view) the source compiled with -mfpmath=387 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34682
[Bug c/34682] 70% slowdown with SSE enabled
--- Comment #3 from rootkit85 at yahoo dot it 2008-01-05 21:32 --- Created an attachment (id=14884) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14884&action=view) the source compiled with -mfpmath=sse -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34682
[Bug c/34682] New: 70% slowdown with SSE enabled
I have a piece of code that runs 70% slower with SSE enabled than with plain 387 on a Dual CPU Xeon system. I'm not an optimization fanatic, but since -mfpmath=sse is enabled by default on amd64 this could cause huge performance losses while making amd64 binaries on this CPU The runlog is: [EMAIL PROTECTED] ~]$ uname -a FreeBSD enc1 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 11:05:30 UTC 2007 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/SMP [EMAIL PROTECTED] ~]$ gcc42 -v Using built-in specs. Target: i386-portbld-freebsd6.2 Configured with: ./..//gcc-4.2-20071024/configure --disable-nls --with-system-zlib --with-libiconv-prefix=/usr/local --with-gmp=/usr/local --program-suffix=42 --libdir=/usr/local/lib/gcc-4.2.3 --with-gxx-include-dir=/usr/local/lib/gcc-4.2.3/include/c++/ --disable-rpath --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc42 i386-portbld-freebsd6.2 Thread model: posix gcc version 4.2.3 20071024 (prerelease) [EMAIL PROTECTED] ~]$ gcc42 ssucks.c -O2 -march=prescott -o ssucks-387 [EMAIL PROTECTED] ~]$ gcc42 ssucks.c -O2 -march=prescott -o ssucks-sse -mfpmath=sse [EMAIL PROTECTED] ~]$ ssucks-387 ; ssucks-sse FLOPS C Program (Double Precision), V2.0 18 Dec 1992 Module ErrorRunTime MFLOPS (usec) 1 4.0146e-13 0.0147953.0052 2 -1.4166e-13 0.0061 1149.6845 FLOPS C Program (Double Precision), V2.0 18 Dec 1992 Module ErrorRunTime MFLOPS (usec) 1 4.0146e-13 0.0146960.7945 2 -1.4166e-13 0.0281249.3171 [EMAIL PROTECTED] ~]$ 1149.6845 vs 249.3171: a ~78% slowdown by just enabling sse I have source, assembled files and runlog online here: http://teknoraver.campuslife.it/software/gcc-sse/ Cheers, Matteo Croce -- Summary: 70% slowdown with SSE enabled Product: gcc Version: 4.2.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rootkit85 at yahoo dot it http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34682
[Bug target/34682] 70% slowdown with SSE enabled
--- Comment #8 from rootkit85 at yahoo dot it 2008-01-07 19:47 --- Created an attachment (id=14895) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14895&action=view) minimal testcase -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34682
[Bug target/34682] 70% slowdown with SSE enabled
--- Comment #9 from rootkit85 at yahoo dot it 2008-01-07 19:47 --- Created an attachment (id=14896) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14896&action=view) minimal testcase, compiled with -mfpmath=387 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34682
[Bug target/34682] 70% slowdown with SSE enabled
--- Comment #10 from rootkit85 at yahoo dot it 2008-01-07 19:47 --- Created an attachment (id=14897) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14897&action=view) minimal testcase, compiled with -mfpmath=sse -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34682
[Bug target/34682] 70% slowdown with SSE enabled
--- Comment #11 from rootkit85 at yahoo dot it 2008-01-07 19:49 --- very very minimal testcase added -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34682
[Bug c/26407] ICE
--- Comment #2 from rootkit85 at yahoo dot it 2006-02-22 14:40 --- I have broken RAM. Sorry for complaining gcc -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26407
[Bug middle-end/36550] Wrong "may be used uninitialized" warning (conditional PHIs)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36550 rootkit85 at yahoo dot it changed: What|Removed |Added CC||rootkit85 at yahoo dot it --- Comment #13 from rootkit85 at yahoo dot it --- can it be the same as this bug I'm experimenting? /*/ /* * compile with: * gcc -Wall -Werror -Os -c test.c -o test.o */ int a; int b; void warn_func(int cond1, int cond2) { int warn; if (cond2) warn = a; if (cond1) b = 1; if (cond2) a = warn; } /*/ I can reproduceit only with -Os, and it makes libgo compilation fail because of this: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgo/runtime/mprof.goc#l403
[Bug go/71697] New: go link error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71697 Bug ID: 71697 Summary: go link error Product: gcc Version: 5.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: go Assignee: ian at airs dot com Reporter: rootkit85 at yahoo dot it CC: cmang at google dot com Target Milestone: --- Created attachment 38788 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38788&action=edit workaround to compile go tool the go tool fails to link. configure options: ./configure --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=i486-openwrt-linux-gnu --with-gnu-ld --enable-target-optspace --disable-libgomp --disable-libmudflap --disable-multilib --disable-nls --without-isl --without-cloog --with-host-libstdcxx=-lstdc++ --disable-decimal-float --with-diagnostics-color=auto-if-env --enable-libssp --enable-__cxa_atexit --disable-libsanitizer --enable-languages=c,c++,go --enable-shared --enable-threads --enable-lto error: make[2]: Entering directory '/home/matteo/src/openwrt/gccbuild/gcc' x86_64-linux-gnu-gcc -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmivirtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -o go1 \ go/ast-dump.o go/dataflow.o go/export.o go/expressions.o go/go-backend.o go/go-dump.o go/go-gcc.o go/go-lang.o go/go-linemap.o go/go-optimize.o go/go.o go/gogo.o go/import.o e.o go/runtime.o go/statements.o go/types.o go/unsafe.o attribs.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a /.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a -lstdc++ -lmpc -lmpfr -lgmp -rdynamic -ldl -lstdc++ -L../zlib -lz /usr/bin/ld: go/export.o: undefined reference to symbol 'ceilf@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status ../../gcc-5.3.0/gcc/go/Make-lang.in:76: recipe for target 'go1' failed make[2]: *** [go1] Error 1 make[2]: Leaving directory '/home/matteo/src/openwrt/gccbuild/gcc' Makefile:4122: recipe for target 'all-gcc' failed make[1]: *** [all-gcc] Error 2 make[1]: Leaving directory '/home/matteo/src/openwrt/gccbuild' Makefile:876: recipe for target 'all' failed make: *** [all] Error 2 Actually I'm compiling it with a workaround, patch is attached Cheers,
[Bug go/71697] go link error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71697 --- Comment #2 from Matteo Croce --- I run Ubuntu 16.04, how can I check if --no-add-needed is default?
[Bug go/71697] go link error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71697 --- Comment #4 from Matteo Croce --- /home/matteo/src/openwrt/build_dir/toolchain-i386_pentium4_gcc-5.3.0_glibc-2.22/gcc-5.3.0-final/./gcc/collect-ld -plugin /home/matteo/src/openwrt/build_dir/toolchain-i386_pentium4_gcc-5.3.0_glibc-2.22/gcc-5.3.0-final/./gcc/liblto_plugin.so -plugin-opt=/home/matteo/src/openwrt/build_dir/toolchain-i386_pentium4_gcc-5.3.0_glibc-2.22/gcc-5.3.0-final/./gcc/lto-wrapper -plugin-opt=-fresolution=/tmp/cc50FwqN.res -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o go crt1.o crti.o /home/matteo/src/openwrt/build_dir/toolchain-i386_pentium4_gcc-5.3.0_glibc-2.22/gcc-5.3.0-final/./gcc/crtbegin.o -L../i486-openwrt-linux-gnu/libgo -L../i486-openwrt-linux-gnu/libgo/.libs -L/home/matteo/src/openwrt/build_dir/toolchain-i386_pentium4_gcc-5.3.0_glibc-2.22/gcc-5.3.0-final/./gcc /tmp/ccSK2xAP.o -lgobegin -lgo -lm --wrap=pthread_create -lgcc_s -lc -lgcc_s /home/matteo/src/openwrt/build_dir/toolchain-i386_pentium4_gcc-5.3.0_glibc-2.22/gcc-5.3.0-final/./gcc/crtend.o crtn.o
[Bug go/71697] go link error
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71697 --- Comment #5 from Matteo Croce --- $ x86_64-linux-gnu-gcc -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -DHAVE_CONFIG_H -o go1 go/ast-dump.o go/dataflow.o go/export.o go/expressions.o go/go-backend.o go/go-dump.o go/go-gcc.o go/go-lang.o go/go-linemap.o go/go-optimize.o go/go.o go/gogo.o go/import.o go/import-archive.o go/lex.o go/parse.o go/runtime.o go/statements.o go/types.o go/unsafe.o attribs.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 -lstdc++ -lmpc -lmpfr -lgmp -rdynamic -ldl -lstdc++ -L../zlib -lz -v Using built-in specs. COLLECT_GCC=x86_64-linux-gnu-gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.3.1-14ubuntu2.1' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2.1) COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/ LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/5/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/5/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-g' '-O2' '-D' 'IN_GCC' '-D' 'CROSS_DIRECTORY_STRUCTURE' '-fno-exceptions' '-fno-rtti' '-fasynchronous-unwind-tables' '-Wextra' '-Wall' '-Wno-narrowing' '-Wwrite-strings' '-Wcast-qual' '-Wsuggest-attribute=format' '-Woverloaded-virtual' '-Wpedantic' '-Wno-long-long' '-Wno-variadic-macros' '-Wno-overlength-strings' '-D' 'HAVE_CONFIG_H' '-o' 'go1' '-rdynamic' '-L../zlib' '-v' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-linux-gnu/5/collect2 -plugin /usr/lib/gcc/x86_64-linux-gnu/5/liblto_plugin.so -plugin-opt=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper -plugin-opt=-fresolution=/tmp/ccAV4PQ1.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr -m elf_x86_64 --hash-style=gnu --as-needed -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -z relro -o go1 /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/5/crtbegin.o -L../zlib -L/usr/lib/gcc/x86_64-linux-gnu/5 -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/5/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/5/../../.. go/ast-dump.o go/dataflow.o go/export.o go/expressions.o go/go-backend.o go/go-dump.o go/go-gcc.o go/go-lang.o go/go-linemap.o go/go-optimize.o go/go.o go/gogo.o go/import.o go/import-archive.o go/lex.o go/parse.o go/runtime.o go/statements.o go/types.o go/unsafe.o attribs.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 -lstdc++ -lmpc -lmpfr -lgmp -ldl -lstdc++ -lz -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/5/crtend.o /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-
[Bug c/102337] New: possibly wrong warning about truncation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102337 Bug ID: 102337 Summary: possibly wrong warning about truncation Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: rootkit85 at yahoo dot it Target Milestone: --- The following code: #include // build with: -O2 -Werror=format-truncation void poke_kprobe_events(int add) { char cmd[192], probename[128], probefunc[128]; snprintf(probename, sizeof(probename), "a"); snprintf(probefunc, sizeof(probefunc), "b"); snprintf(cmd, sizeof(cmd), "%s %s", probename, probefunc); } Generates the following warning: $ gcc -O2 -c test.c -Werror=format-truncation test.c: In function ‘poke_kprobe_events’: test.c:11:40: error: ‘%s’ directive output may be truncated writing up to 127 bytes into a region of size between 64 and 191 [-Werror=format-truncation=] 11 | snprintf(cmd, sizeof(cmd), "%s %s", probename, probefunc); |^~ ~ test.c:11:9: note: ‘snprintf’ output between 2 and 256 bytes into a destination of size 192 11 | snprintf(cmd, sizeof(cmd), "%s %s", probename, probefunc); | ^ cc1: some warnings being treated as errors I'm using the Fedora 34 packages: $ gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-11.2.1-20210728/obj-x86_64-redhat-linux/isl-install --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --enable-cet --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.2.1 20210728 (Red Hat 11.2.1-1) (GCC)