[Bug tree-optimization/81900] [8 Regression] GCC trunk miscompiles Perl / __sigsetjmp issue
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81900 Yui NARUSE changed: What|Removed |Added CC||naruse at airemix dot jp --- Comment #10 from Yui NARUSE --- *** Bug 81954 has been marked as a duplicate of this bug. ***
[Bug middle-end/81954] gcc8 too aggressively reorders memory access beyond condition
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81954 Yui NARUSE changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE --- Comment #3 from Yui NARUSE --- (In reply to Richard Biener from comment #2) > Or this is a dup of PR81900 which is meanwhile fixed (but not in your > version). I confirmed it is fixed by s20170827. Thank you for pointing out! *** This bug has been marked as a duplicate of bug 81900 ***
[Bug c/81954] New: gcc8 too aggressively reorders memory access beyond condition
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81954 Bug ID: 81954 Summary: gcc8 too aggressively reorders memory access beyond condition Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: naruse at airemix dot jp Target Milestone: --- Created attachment 42032 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42032=edit vm.i, generated from vm.c Environments: shown below the preprocessed file (*.i*): attached vm.i How to reproduce from source: % gcc8 -v Using built-in specs. COLLECT_GCC=gcc8 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc8/gcc/x86_64-portbld-freebsd10.3/8.0.0/lto-wrapper Target: x86_64-portbld-freebsd10.3 Configured with: /wrkdirs/usr/ports/lang/gcc8-devel/work/gcc-8-20170820/configure --with-build-config=bootstrap-debug --disable-nls --enable-gnu-indirect-function --libdir=/usr/local/lib/gcc8 --libexecdir=/usr/local/libexec/gcc8 --program-suffix=8 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc8/include/c++/ --with-ld=/usr/local/bin/ld --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --enable-languages=c,c++,objc,fortran --prefix=/usr/local --localstatedir=/var --mandir=/usr/local/man --infodir=/usr/local/info/gcc8 --build=x86_64-portbld-freebsd10.3 Thread model: posix gcc version 8.0.0 20170820 (experimental) (FreeBSD Ports Collection) % git clone g...@github.com:ruby/ruby.git % cd ruby % autoconf % ./configure optflags='-O3 -Wl,-rpath=/usr/local/lib/gcc8' --with-gcc='/usr/local/bin/gcc8' % make miniruby % gdb --args ./miniruby -e'Thread.new("foo", (:class_eval)).join' GNU gdb (GDB) 8.0 [GDB v8.0 for FreeBSD] Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-portbld-freebsd10.3". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./miniruby...done. (gdb) r Starting program: /tmp/ruby/miniruby -eThread.new\(\"foo\",\ \\(:class_eval\)\).join [New LWP 101479 of process 94182] [New LWP 101478 of process 94182] Thread 2 received signal SIGSEGV, Segmentation fault. [Switching to LWP 101479 of process 94182] 0x0124c591 in rb_vm_get_ruby_level_next_cfp (cfp=0x805506000, th=) at vm.c:505 505 cfp = RUBY_VM_PREVIOUS_CONTROL_FRAME(cfp); (gdb) disas 0x0124c591-61,+116 Dump of assembler code from 0x124c554 to 0x124c5c8: 0x0124c554 <eval_string_with_cref+116>: mov0x60(%rsp),%rdx 0x0124c559 <eval_string_with_cref+121>: mov0x28(%rdx),%rcx 0x0124c55d <eval_string_with_cref+125>: mov0x20(%rdx),%rdx 0x0124c561 <eval_string_with_cref+129>: mov0x30(%rax),%rax 0x0124c565 <eval_string_with_cref+133>: lea (%rdx,%rcx,8),%rcx 0x0124c569 <eval_string_with_cref+137>: cmp%rcx,%rax 0x0124c56c <eval_string_with_cref+140>: jae0x124c59f <eval_string_with_cref+191> 0x0124c56e <eval_string_with_cref+142>: mov0x20(%rax),%rdx 0x0124c572 <eval_string_with_cref+146>: testb $0x80,(%rdx) 0x0124c575 <eval_string_with_cref+149>: jne0x124c589 <eval_string_with_cref+169> 0x0124c577 <eval_string_with_cref+151>: jmpq 0x124c6d8 <eval_string_with_cref+504> 0x0124c57c <eval_string_with_cref+156>: nopl 0x0(%rax) 0x0124c580 <eval_string_with_cref+160>: test %rdx,%rdx 0x0124c583 <eval_string_with_cref+163>: je 0x124c6d8 <eval_string_with_cref+504> 0x0124c589 <eval_string_with_cref+169>: add$0x30,%rax 0x0124c58d <eval_string_with_cref+173>: mov0x20(%rax),%rdx => 0x0124c591 <eval_string_with_cref+177>: mov(%rdx),%rdx 0x0124c594 <eval_string_with_cref+180>: and$0x80,%edx 0x0124c59a <eval_string_with_cref+186>: cmp%rax,%rcx 0x0124c59d <eval_string_with_cref+189>: ja 0x124c580 <eval_string_with_cref+160> 0x000
[Bug c/57621] New: -Og
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57621 Bug ID: 57621 Summary: -Og Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: naruse at airemix dot jp Folloing program is to verify func's argument is not larger than 3 at compile time. And this program uses valid argument 0. Threfore I want the code is compiled without error. This idea works on -O, -O1, -O2, -O3, -Os. But on -Og, it fails with attribute error. Of course it is not what I want, but is this intended behavior? % cat og.c #include stdio.h int ruby$safe_level$4(void) __attribute__((error($SAFE=4 is obsolete))); #define func(a) (__builtin_constant_p(a) (a) 3) ? ruby$safe_level$4() : (a) struct foo { int n; }; void show(struct foo *p) { printf(%d\n, func(p-n)); } void hoge(void) { struct foo f; f.n = 0; show(f); } int main(void) { hoge(); return 0; } % gcc49 -O og.c ./a.out 0 % gcc49 -Og og.c ./a.out og.c: In function 'show': og.c:9:11: error: call to 'ruby$safe_level$4' declared with attribute error: $SAFE=4 is obsolete printf(%d\n, func(p-n)); ^ % gcc49 -v Using built-in specs. COLLECT_GCC=gcc49 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc49/gcc/x86_64-portbld-freebsd9.1/4.9.0/lto-wrapper Target: x86_64-portbld-freebsd9.1 Configured with: ./../gcc-4.9-20130526/configure --disable-nls --libdir=/usr/local/lib/gcc49 --libexecdir=/usr/local/libexec/gcc49 --program-suffix=49 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc49/include/c++/ --with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --disable-libgcj --enable-languages=c,c++,objc,fortran --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc49 --build=x86_64-portbld-freebsd9.1 Thread model: posix gcc version 4.9.0 20130526 (experimental) (FreeBSD Ports Collection) % uname -a FreeBSD windy.airemix.net 9.1-RELEASE-p3 FreeBSD 9.1-RELEASE-p3 #0: Mon Apr 29 18:27:25 UTC 2013 r...@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64
[Bug c/51862] New: Over optimization for assignments to char[] defined inner than used
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51862 Bug #: 51862 Summary: Over optimization for assignments to char[] defined inner than used Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: nar...@airemix.jp GCC 4.7 optimization out assignments to char[] if the char[] is defined inner than it is used. The too simplified case is like following (func() changes buf and enough small to inline): char *res; if (bool) { char buf[4]; func(buf); res = buf; } fprintf(stderr, '%s'\n, res); = gcc47 -v Using built-in specs. COLLECT_GCC=gcc47 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/lto-wrapper Target: x86_64-portbld-freebsd9.0 Configured with: ./../gcc-4.7-20111217/configure --disable-nls --enable-languages=c,c++,fortran --libdir=/usr/local/lib/gcc47 --libexecdir=/usr/local/libexec/gcc47 --program-suffix=47 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc47/include/c++/ --with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local --with-pkgversion='FreeBSD Ports Collection' --with-system-zlib --disable-libgcj --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc47 --build=x86_64-portbld-freebsd9.0 Thread model: posix gcc version 4.7.0 20111217 (experimental) (FreeBSD Ports Collection) = the complete command line that triggers the bug % gcc47 -O2 g.c./a.out # type \u0061 \u0061 1 '' The resulted output must be following and works with -O0: 1 'a' = the compiler output (error messages, warnings, etc.) Using built-in specs. COLLECT_GCC=gcc47 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/lto-wrapper Target: x86_64-portbld-freebsd9.0 Configured with: ./../gcc-4.7-20111217/configure --disable-nls --enable-languages=c,c++,fortran --li bdir=/usr/local/lib/gcc47 --libexecdir=/usr/local/libexec/gcc47 --program-suffix=47 --with-as=/usr/l ocal/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc47/include/c++/ --with-ld =/usr/local/bin/ld --with-libiconv-prefix=/usr/local --with-pkgversion='FreeBSD Ports Collection' -- with-system-zlib --disable-libgcj --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/i nfo/gcc47 --build=x86_64-portbld-freebsd9.0 Thread model: posix gcc version 4.7.0 20111217 (experimental) (FreeBSD Ports Collection) COLLECT_GCC_OPTIONS='-O2' '-save-temps' '-v' '-mtune=generic' '-march=x86-64' /usr/local/libexec/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/cc1 -E -quiet -v g.c -mtune=generic -m arch=x86-64 -O2 -fpch-preprocess -o g.i ignoring nonexistent directory /usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/../../../.. /../x86_64-portbld-freebsd9.0/include #include ... search starts here: #include ... search starts here: /usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/include /usr/local/include /usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-O2' '-save-temps' '-v' '-mtune=generic' '-march=x86-64' /usr/local/libexec/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/cc1 -fpreprocessed g.i -quiet -dumpbase g.c -mtune=generic -march=x86-64 -auxbase g -O2 -version -o g.s GNU C (FreeBSD Ports Collection) version 4.7.0 20111217 (experimental) (x86_64-portbld-freebsd9.0) compiled by GNU C version 4.7.0 20111217 (experimental), GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C (FreeBSD Ports Collection) version 4.7.0 20111217 (experimental) (x86_64-portbld-freebsd9.0) compiled by GNU C version 4.7.0 20111217 (experimental), GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 7130d1c9d6c474bcedaf92254d46803f COLLECT_GCC_OPTIONS='-O2' '-save-temps' '-v' '-mtune=generic' '-march=x86-64' /usr/local/bin/as -v -o g.o g.s GNU assembler version 2.22 (x86_64-portbld-freebsd9.0) using BFD version (GNU Binutils) 2.22 COMPILER_PATH=/usr/local/libexec/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/:/usr/local/libexec/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/:/usr/local/libexec/gcc47/gcc/x86_64-portbld-freebsd9.0/:/usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/:/usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd9.0/:/usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/../../../../../x86_64-portbld-freebsd9.0/bin/ LIBRARY_PATH=/usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/:/usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/../../../../../x86_64-portbld-freebsd9.0/lib/:/usr/local/lib/gcc47/gcc/x86_64-portbld-freebsd9.0/4.7.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-O2'
[Bug c/51862] Over optimization for assignments to char[] defined inner than used
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51862 --- Comment #1 from Yui NARUSE naruse at airemix dot jp 2012-01-15 01:25:57 UTC --- Created attachment 26327 -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=26327 the preprocessed file