[Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515 Richard Guenther changed: What|Removed |Added Status|UNCONFIRMED |WAITING Last reconfirmed||2012-09-07 Ever Confirmed|0 |1 --- Comment #1 from Richard Guenther 2012-09-07 10:24:50 UTC --- Attachment missing.
[Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515 --- Comment #2 from Werner Henze 2012-09-07 10:53:33 UTC --- Created attachment 28144 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28144 preprocessed file as written by the sigsegv handler
[Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515 --- Comment #3 from Werner Henze 2012-09-07 11:49:43 UTC --- Created attachment 28145 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28145 preprocessed file as written by the sigsegv handler Just saw a second sigsegv. This might be related to the bug (including same project files), but it might also be another bug. This compilation succeeds with -O0 and -O1, it crashes with -O3, -O2 and -Os. In this case there is no anonymous namespace involved.
[Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515 Markus Trippelsdorf changed: What|Removed |Added CC||markus at trippelsdorf dot ||de --- Comment #4 from Markus Trippelsdorf 2012-09-07 11:56:34 UTC --- gcc-4.7 and 4.8 are also affected. markus@x4 tmp % cat test.ii template < typename T > T h2le (T) { T a; unsigned short &b = a; short c = 0; unsigned char (&d)[2] = reinterpret_cast < unsigned char (&)[2] > (c); unsigned char (&e)[2] = reinterpret_cast < unsigned char (&)[2] > (b); e[0] = d[0]; return a; } void bar () { h2le ((unsigned short) 0); } markus@x4 tmp % gdb /var/tmp/foo/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.0/g++ Reading symbols from /var/tmp/foo/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.0/g++...done. (gdb) run -c -O2 -std=c++0x test.ii Starting program: /var/tmp/foo/usr/x86_64-pc-linux-gnu/gcc-bin/4.8.0/g++ -c -O2 -std=c++0x test.ii warning: no loadable sections found in added symbol-file system-supplied DSO at 0x77ffa000 [New process 18282] process 18282 is executing new program: /var/tmp/foo/usr/libexec/gcc/x86_64-pc-linux-gnu/4.8.0/cc1plus Program received signal SIGSEGV, Segmentation fault. [Switching to process 18282] 0x008b5803 in disqualify_base_of_expr(tree_node*, char const*) () at ../../gcc/gcc/tree-sra.c:987 987 ../../gcc/gcc/tree-sra.c: No such file or directory. (gdb) bt #0 0x008b5803 in disqualify_base_of_expr(tree_node*, char const*) () at ../../gcc/gcc/tree-sra.c:987 #1 0x008b6eb5 in build_access_from_expr_1(tree_node*, gimple_statement_d*, bool) () at ../../gcc/gcc/tree-sra.c:1025 #2 0x008b74ab in scan_function() () at ../../gcc/gcc/tree-sra.c:1119 #3 0x008bb622 in ipa_early_sra() () at ../../gcc/gcc/tree-sra.c:4814 #4 0x007ca012 in execute_one_pass(opt_pass*) () at ../../gcc/gcc/passes.c:2158 #5 0x007ca385 in execute_pass_list(opt_pass*) () at ../../gcc/gcc/passes.c:2213 #6 0x007ca397 in execute_pass_list(opt_pass*) () at ../../gcc/gcc/passes.c:2214 #7 0x007c95fd in do_per_function_toporder(void (*)(void*), void*) () at ../../gcc/gcc/passes.c:1702 #8 0x007ca7ec in execute_ipa_pass_list(opt_pass*) () at ../../gcc/gcc/passes.c:2527 #9 0x0064f758 in compile() () #10 0x0064fb15 in finalize_compilation_unit() () #11 0x00528a57 in cp_write_global_declarations() () at ../../gcc/gcc/cp/decl2.c:4024 #12 0x0085a565 in compile_file() () #13 0x0085bd5a in toplev_main(int, char**) () #14 0x774ef755 in __libc_start_main () from /lib/libc.so.6 #15 0x004c8249 in _start ()
[Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515 --- Comment #5 from Markus Trippelsdorf 2012-09-07 11:59:45 UTC --- (In reply to comment #3) > Created attachment 28145 [details] > preprocessed file as written by the sigsegv handler > > Just saw a second sigsegv. This might be related to the bug (including same > project files), but it might also be another bug. > This compilation succeeds with -O0 and -O1, it crashes with -O3, -O2 and -Os. > In this case there is no anonymous namespace involved. It's the same issue.
[Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515 --- Comment #6 from Markus Trippelsdorf 2012-09-07 15:23:04 UTC --- The following patch fixes the issue for me: diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index aafaa15..2bb92e9 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -984,7 +984,8 @@ static void disqualify_base_of_expr (tree t, const char *reason) { t = get_base_address (t); - if (sra_mode == SRA_MODE_EARLY_IPA + if (t + && sra_mode == SRA_MODE_EARLY_IPA && TREE_CODE (t) == MEM_REF) t = get_ssa_base_param (TREE_OPERAND (t, 0));
[Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515 --- Comment #7 from Richard Guenther 2012-09-10 09:48:32 UTC --- Author: rguenth Date: Mon Sep 10 09:48:28 2012 New Revision: 191130 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191130 Log: 2012-09-07 Markus Trippelsdorf PR middle-end/54515 * tree-sra.c (disqualify_base_of_expr): Check for possible NULL_TREE returned by get_base_address() * g++.dg/tree-ssa/pr54515.C: new testcase Added: branches/gcc-4_7-branch/gcc/testsuite/g++.dg/tree-ssa/pr54515.C Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/testsuite/ChangeLog branches/gcc-4_7-branch/gcc/tree-sra.c
[Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515 --- Comment #8 from Richard Guenther 2012-09-10 09:50:07 UTC --- Author: rguenth Date: Mon Sep 10 09:50:02 2012 New Revision: 191131 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191131 Log: 2012-09-10 Markus Trippelsdorf PR middle-end/54515 * tree-sra.c (disqualify_base_of_expr): Check for possible NULL_TREE returned by get_base_address() * g++.dg/tree-ssa/pr54515.C: new testcase Added: branches/gcc-4_6-branch/gcc/testsuite/g++.dg/tree-ssa/pr54515.C Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/testsuite/ChangeLog branches/gcc-4_6-branch/gcc/tree-sra.c
[Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515 Richard Guenther changed: What|Removed |Added Status|WAITING |ASSIGNED AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org |gnu.org | --- Comment #9 from Richard Guenther 2012-09-10 11:33:03 UTC --- Testing sth different for trunk.
[Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515 --- Comment #10 from Richard Guenther 2012-09-11 08:32:43 UTC --- Author: rguenth Date: Tue Sep 11 08:32:29 2012 New Revision: 191174 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191174 Log: 2012-09-11 Richard Guenther PR middle-end/54515 * gimple.c (get_base_address): Do not return NULL_TREE apart from for WITH_SIZE_EXPR. * gimple-fold.c (canonicalize_constructor_val): Do not call get_base_address when not necessary. * g++.dg/tree-ssa/pr54515.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/tree-ssa/pr54515.C Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-fold.c trunk/gcc/gimple.c trunk/gcc/testsuite/ChangeLog
[Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515 Richard Guenther changed: What|Removed |Added Status|ASSIGNED|RESOLVED Known to work||4.6.4, 4.7.2, 4.8.0 Resolution||FIXED Known to fail||4.6.3, 4.7.1 --- Comment #10 from Richard Guenther 2012-09-11 08:32:43 UTC --- Author: rguenth Date: Tue Sep 11 08:32:29 2012 New Revision: 191174 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191174 Log: 2012-09-11 Richard Guenther PR middle-end/54515 * gimple.c (get_base_address): Do not return NULL_TREE apart from for WITH_SIZE_EXPR. * gimple-fold.c (canonicalize_constructor_val): Do not call get_base_address when not necessary. * g++.dg/tree-ssa/pr54515.C: New testcase. Added: trunk/gcc/testsuite/g++.dg/tree-ssa/pr54515.C Modified: trunk/gcc/ChangeLog trunk/gcc/gimple-fold.c trunk/gcc/gimple.c trunk/gcc/testsuite/ChangeLog --- Comment #11 from Richard Guenther 2012-09-11 08:33:36 UTC --- Fixed.
[Bug middle-end/54515] cc1plus sigsegv -O2 anonymous namespace
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54515 Richard Guenther changed: What|Removed |Added Status|ASSIGNED|RESOLVED Known to work||4.6.4, 4.7.2, 4.8.0 Resolution||FIXED Known to fail||4.6.3, 4.7.1 --- Comment #11 from Richard Guenther 2012-09-11 08:33:36 UTC --- Fixed.