[Bug c++/98682] New: g++ allows goto inside statement expr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98682 Bug ID: 98682 Summary: g++ allows goto inside statement expr Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nbkolchin at gmail dot com Target Milestone: --- The following obviously incorrect program compiles without error under g++: #include int main(int argc, char** argv) { goto L_bug; printf("%s, %s %s\n", "Hello", ({ L_bug: ; "world!";}), "What?"); } gcc produces error: "error: jump into statement expression". Tested under gcc versions: 6.3.0, 7.5.0, 10.2.0. This behaviour contradicts with documentation: "Jumping into a statement expression with goto or using a switch statement outside the statement expression with a case or default label inside the statement expression is not permitted."
[Bug c++/53431] C++ preprocessor ignores #pragma GCC diagnostic
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431 --- Comment #38 from Nickolay Kolchin-Semyonov --- Since this is a long standing problem, maybe this limitation should be mentioned in official documentation?
[Bug c/89807] New: Incorrect -Wconversion warning when shifting uint32_t with 24
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89807 Bug ID: 89807 Summary: Incorrect -Wconversion warning when shifting uint32_t with 24 Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: nbkolchin at gmail dot com Target Milestone: --- https://godbolt.org/z/x2vI6l Sample code: #include int test(uint32_t v) { uint8_t a = (v >> 24) & 0xFF; // ERROR: produces warning uint8_t a2 = v >> 24; // ERROR: produces warning uint8_t b = (v >> 16) & 0xFF; // OK uint8_t c = (v >> 8) & 0xFF; // OK uint8_t d = v & 0xFF; // OK return a + a2 + b + c + d; } Compile with -Werror=conversion: : In function 'test': :5:17: error: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Werror=conversion] 5 | uint8_t a = (v >> 24) & 0xFF; | ^ :6:18: error: conversion from 'uint32_t' {aka 'unsigned int'} to 'uint8_t' {aka 'unsigned char'} may change value [-Werror=conversion] 6 | uint8_t a2 = v >> 24; | ^ cc1: some warnings being treated as errors Compiler returned: 1 P.S. Clang compiles this code without warnings.
[Bug c++/89806] New: Different behaviour for "pragma diagnostic disabled" between gcc and g++
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89806 Bug ID: 89806 Summary: Different behaviour for "pragma diagnostic disabled" between gcc and g++ Product: gcc Version: 8.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nbkolchin at gmail dot com Target Milestone: --- https://godbolt.org/z/J0xdIL Sample code: #pragma GCC diagnostic ignored "-Wdate-time" const char* g_test = "dirty-" __DATE__; When compiling with g++ (g++ -Werror=date-time) this produces: :2:31: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time] 2 | const char* g_test = "dirty-" __DATE__; | ^~~~ cc1plus: some warnings being treated as errors Compiler returned: 1 But with GCC this compiles without errors (gcc -Werror=date-time). https://godbolt.org/z/a4ZymR
[Bug c/89165] New: miscompile calling SSE function from non-SSE code
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89165 Bug ID: 89165 Summary: miscompile calling SSE function from non-SSE code Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: nbkolchin at gmail dot com Target Milestone: --- BUG: calling SSE function with vector argument from non-SSE code (admittedly, Bad Idea) silently miscompiles (breaking calling convention). I would appreciate an error message instead. https://godbolt.org/z/pIpM95 GCC Version: 8.2 Command line arguments: -m32 -mno-sse -O2 Source code: typedef float __attribute__((vector_size(16))) simd4f; __attribute__((target("sse2"))) simd4f f(simd4f a) {return a*a;} simd4f g(simd4f a,simd4f b) {return f(a)+f(b);} Generated assembler: f(float __vector(4)): mulps %xmm0, %xmm0 ret g(float __vector(4), float __vector(4)): subl$76, %esp movl80(%esp), %eax leal16(%esp), %edx pushl 108(%esp) pushl 108(%esp) pushl 108(%esp) pushl 108(%esp) subl$12, %esp pushl %edx callf(float __vector(4)) leal60(%esp), %edx addl$28, %esp pushl 124(%esp) pushl 124(%esp) pushl 124(%esp) pushl 124(%esp) subl$12, %esp pushl %edx callf(float __vector(4)) flds44(%esp) fadds 60(%esp) fstps 28(%esp) flds48(%esp) fadds 64(%esp) movl28(%esp), %edx fstps 32(%esp) flds52(%esp) fadds 68(%esp) fstps 36(%esp) flds56(%esp) fadds 72(%esp) fstps 40(%esp) movl%edx, (%eax) movl32(%esp), %edx movl%edx, 4(%eax) movl36(%esp), %edx movl%edx, 8(%eax) movl40(%esp), %edx movl%edx, 12(%eax) addl$104, %esp ret $4 P.S. Originally found here https://gamedev.ru/code/forum/?id=233033=24#m356
[Bug c/88587] [6.1/trunk] internal compiler error: in expand_debug_locations, at cfgexpand.c:5450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88587 --- Comment #1 from Nickolay Kolchin-Semyonov --- Error seems to happen when both: 1. Vector extensions are used. 2. Both SSE and non-SSE versions are requested. Error seems to be present in all GCC versions since 6.1 (which introduced target_clones).
[Bug c/88587] New: [6.1/trunk] internal compiler error: in expand_debug_locations, at cfgexpand.c:5450
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88587 Bug ID: 88587 Summary: [6.1/trunk] internal compiler error: in expand_debug_locations, at cfgexpand.c:5450 Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: nbkolchin at gmail dot com Target Milestone: --- https://godbolt.org/z/I8yw2T typedef float __attribute__((vector_size(16))) simd4f; __attribute__((target_clones("default,sse2"))) void f(int n,const float *m,float *vertices) { simd4f v0={m[ 0],m[ 4],m[ 8],m[12]}; simd4f v1={m[ 1],m[ 5],m[ 9],m[13]}; simd4f v2={m[ 2],m[ 6],m[10],m[14]}; simd4f v3={m[ 3],m[ 7],m[11],m[15]}; for(int i=0;i: In function 'void _Z1fiPKfPf.sse2.0(int, const float*, float*)': :14:6: internal compiler error: in expand_debug_locations, at cfgexpand.c:5450 14 | void f(int n,const float *m,float *vertices) | ^ Please submit a full bug report,
[Bug tree-optimization/57358] segmentation fault with attribute(optimize(O0))
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57358 --- Comment #1 from Nickolay Kolchin-Semyonov nbkolchin at gmail dot com --- Reproducable with gcc-4.8.1. Using built-in specs. COLLECT_GCC=gcc-4.8.1 COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /mnt/work/tmp/portage/sys-devel/gcc-4.8.1/work/gcc-4.8.1/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.1 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.8.1/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --with-cloog --disable-isl-version-check --enable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.8.1/python --enable-checking=release --disable-libgcj --enable-libstdcxx-time --enable-languages=c,c++,go,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.8.1 p1.0, pie-0.5.6' Thread model: posix gcc version 4.8.1 (Gentoo 4.8.1 p1.0, pie-0.5.6) $ gcc-4.8.1 -O3 -c no-optimize.c no-optimize.c: In function ‘test_func’: no-optimize.c:7:1: internal compiler error: Segmentation fault } ^
[Bug tree-optimization/57358] segmentation fault with attribute(optimize(O0))
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57358 --- Comment #2 from Nickolay Kolchin-Semyonov nbkolchin at gmail dot com --- More simplified test variant: struct t { void (*func)(void*); }; void test_func(struct t* a) __attribute__((optimize(O0))); void test_func(struct t* a) { a-func(0); } P.S. If you compile this as C++ code, no segmentation fault would occure.
[Bug tree-optimization/57358] New: segmentation fault with attribute(optimize(O0))
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57358 Bug ID: 57358 Summary: segmentation fault with attribute(optimize(O0)) Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: nbkolchin at gmail dot com Created attachment 30157 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=30157action=edit backtrace The following code crashes GCC (gcc-4.8.0 -O2): typedef void (*done)(void* arg); struct t { done func; void* arg; }; static void test_func() __attribute__((optimize(O0))); static void test_func(struct t* a) { a-func(a-arg); } Program received signal SIGSEGV, Segmentation fault. walk_aliased_vdefs_1 (ref=ref@entry=0x7fffda70, vdef=0x0, walker=0x6f5d90 mark_modified(ao_ref*, tree, void*), data=0x7fffda5f, visited=0x7fffda28, cnt=0) at /mnt/work/oktet/transas/sources/4.8/gcc/gcc/tree-ssa-alias.c:2196 2196 gimple def_stmt = SSA_NAME_DEF_STMT (vdef); Backtrace from gdb attached. Reproducable with custom GCC build and gentoo 4.8. No error in 4.7.
[Bug target/33431] [SH4] performance regression between 3.4.6 and 4.x
--- Comment #4 from nbkolchin at gmail dot com 2007-09-15 12:13 --- There are no differences in cc1 --target-help output. I will try to split scimark in small pieces and test them separately. Thank you for your help. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33431
[Bug target/33431] New: [SH4] performance regression between 3.4.6 and 4.x
I've found serious performance regression between GCC version 3.4.6 and 4.2/4.3. SciMark2 Numeric Benchmark, see http://math.nist.gov/scimark GCC: 3.4.6 4.2.1 4.3.0 (20070907) Composite: 6.055.014.82 FFT: 4.904.154.21 SOR: 10.108.367.64 MonteCarlo: 3.683.063.04 Sparse matmult: 5.454.454.03 LU: 6.105.035.18 BYTEmark* Native Mode Benchmark ver. 2 (10/95) GCC: 3.4.6 4.2.1 4.3.0 (20070907) NUMERIC SORT: 35.459 32.2 29.327 STRING SORT: 0.59430.57604 0.8603 BITFIELD: 1.0585e+07 9.269e+06 9.4138e+06 FP EMULATION: 4.4944 4.6012 5.364 FOURIER: 272.28 241.34 259.12 ASSIGNMENT:0.359970.38373 0.39683 IDEA: 124.11 95.057 100.07 HUFFMAN: 45.593 52.083 56.391 NEURAL NET:0.361530.30922 0.31348 LU DECOMPOSITION: 11.331 9.4938 8.255 The real world application has 20%-200% performance regression with GCC 4.x. All tests were compiled with this arguments: -O3 -ffast-math -fomit-frame-pointer -funroll-loops -ftracer -funit-at-a-time -m4 -ml This arguments were tuned for the best results under 3.4.6. I've played with various settings under 4.x, but can't achieve any performance improvement. I can rerun them with any key combination you want. This tests compilable under Linux can be downloaded from: - scimark: http://oktetlabs.ru/~snob/scimark.tgz - nbench: http://oktetlabs.ru/~snob/nbench.tgz I can attach this files to bugreport if this is acceptable and will not pollute bugzilla. Our target hardware has SH7750 processor running in little endian mode under RTEMS. Unfortunetaly there is no way to boot linux there. Can I ask you to run this tests under linux-sh? At least scimark one. After lurking inside backend sources, I found that m4 has several variants in GCC 4.x: m4-100, m4-200, etc. I've tried to compile this tests with m4-200 switch, but it looks like m4-200 enforces big-endian. Backend sources show, that there is a lot of work going on SH4 GCC part. I also wrote simple stupid tests to compare code generation between different compiler versions (I can mail/attach them to you, but they are really stupid) to understand what can cause such performance regression. But generated assembler is really different across versions. I can found only two obvious things: - GCC4 has a much more aggressive inline and loop unrolling. (-funroll-loops was dropped from compiler arguments with no positive result) - GCC4 has different command scheduling, which probably leads to performance regression. -- Summary: [SH4] performance regression between 3.4.6 and 4.x Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nbkolchin at gmail dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: sh-unknown-rtemself http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33431
[Bug target/33431] [SH4] performance regression between 3.4.6 and 4.x
--- Comment #2 from nbkolchin at gmail dot com 2007-09-14 16:10 --- Thank you for your reply. Variants: - you are not using: -m4 -ml, but some other architecture settings. - SH7751R and SH7750R have different instruction pipeline (probably not, both are SH4-200 variants as I know). - gcc for linux is different from gcc for RTEMS (how this can be checked?) - processor endians are different. -- nbkolchin at gmail dot com changed: What|Removed |Added CC||nbkolchin at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33431
[Bug target/29953] New: [SH-4] Perfomance regression in loops. cmp/eq used instead of dt
GCC 4.1.1 (probably all 4.* versions, tested 4.3.0-svn also), uses cmp/eq instead of dt in loops. This leads to ~20% perfomance decrease. Technically, loop processing algorithm is completely different between versions. Example (sources in attach): CFLAGS=-m4 -O3 -fomit-frame-pointer gcc 3.4.4: .LFB2: mov.l .L11,r3 mov #0,r0 mov.l .L12,r2 .L5: mov.l @r3+,r1 ! !!! dt r2 ! !!! bf/s.L5 add r1,r0 rts nop .L13: .align 2 .L11: .long -1946157056 .L12: .long 100 - gcc 4.1.1: - .LFB2: mov.l .L8,r2 mov #0,r0 mov.l .L9,r3 .L2: mov.l @r2+,r1 ! !!! cmp/eq r3,r2 ! !!! bf/s.L2 add r1,r0 rts nop .L10: .align 2 .L8: .long -1946157056 .L9: .long -1942157056 - P.S. We are porting application from gcc3.4 to gcc4.1 and have about 60% perfomance decrease. So this is probably just first report. :( -- Summary: [SH-4] Perfomance regression in loops. cmp/eq used instead of dt Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nbkolchin at gmail dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: sh-rtemself http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29953
[Bug target/29953] [SH-4] Perfomance regression in loops. cmp/eq used instead of dt
--- Comment #1 from nbkolchin at gmail dot com 2006-11-23 10:15 --- Created an attachment (id=12671) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12671action=view) test.cpp Testcase -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29953
[Bug regression/26658] New: perfomance regression between gcc 3.4.5 and 4.*
-gnu/4.1.0/man --infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.0/info --with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.0/include/g++-v4 --host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec --enable-nls --without-included-gettext --with-system-zlib --disable-checking --disable-werror --disable-libunwind-exceptions --disable-multilib --disable-libmudflap --disable-libssp --enable-java-awt=gtk --enable-languages=c,c++,java,objc,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu Thread model: posix gcc version 4.1.0 (Gentoo 4.1.0-r2, pie-8.7.8) /usr/libexec/gcc/i686-pc-linux-gnu/4.1.0/cc1plus -E -quiet -v -D_GNU_SOURCE test_cmd.cpp -march=athlon-xp -O3 -fpch-preprocess -o test_cmd.ii ignoring nonexistent directory /usr/lib/gcc/i686-pc-linux-gnu/4.1.0/../../../../i686-pc-linux-gnu/include #include ... search starts here: #include ... search starts here: /usr/include/libffi /usr/lib/gcc/i686-pc-linux-gnu/4.1.0/include/g++-v4 /usr/lib/gcc/i686-pc-linux-gnu/4.1.0/include/g++-v4/i686-pc-linux-gnu /usr/lib/gcc/i686-pc-linux-gnu/4.1.0/include/g++-v4/backward /usr/local/include /usr/lib/gcc/i686-pc-linux-gnu/4.1.0/include /usr/include End of search list. /usr/libexec/gcc/i686-pc-linux-gnu/4.1.0/cc1plus -fpreprocessed test_cmd.ii -quiet -dumpbase test_cmd.cpp -march=athlon-xp -auxbase test_cmd -O3 -version -o test_cmd.s GNU C++ version 4.1.0 (Gentoo 4.1.0-r2, pie-8.7.8) (i686-pc-linux-gnu) compiled by GNU C version 4.1.0 (Gentoo 4.1.0-r2, pie-8.7.8). GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129319 Compiler executable checksum: d3096f5bd00a04a18edac8d63d29a37f --- -- Summary: perfomance regression between gcc 3.4.5 and 4.* Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: regression AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: nbkolchin at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26658
[Bug regression/26658] perfomance regression between gcc 3.4.5 and 4.*
--- Comment #1 from nbkolchin at gmail dot com 2006-03-12 20:12 --- Created an attachment (id=11027) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11027action=view) test_cmd.cpp testcase. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26658
[Bug regression/26658] perfomance regression between gcc 3.4.5 and 4.*
--- Comment #2 from nbkolchin at gmail dot com 2006-03-12 20:13 --- Created an attachment (id=11028) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11028action=view) test_cmd-3.4.5.ii -save-temps output from gcc 3.4.5 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26658
[Bug regression/26658] perfomance regression between gcc 3.4.5 and 4.*
--- Comment #3 from nbkolchin at gmail dot com 2006-03-12 20:14 --- Created an attachment (id=11029) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=11029action=view) test_cmd-4.1.0.ii -save-temps output from gcc 4.1.0 and gcc 4.0.2 (they are different only in version numbers) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26658