http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60002

            Bug ID: 60002
           Summary: ICE: SIGSEGV in skip_artificial_parms_for() with -O2
                    -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zsojka at seznam dot cz

Created attachment 31994
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31994&action=edit
reduced testcase

Compiler output:
$ gcc -O2 -fcompare-debug -fdeclone-ctor-dtor -fipa-cp-clone testcase.C
==2803== Invalid read of size 2
==2803==    at 0x7A87C0: skip_artificial_parms_for(tree_node const*,
tree_node*) (tree.h:2822)
==2803==    by 0x7282E0: dump_function_decl(cxx_pretty_printer*, tree_node*,
int) (error.c:1453)
==2803==    by 0x72A1A5: decl_as_string(tree_node*, int) (error.c:2732)
==2803==    by 0x7DD572: cxx_printable_name_internal(tree_node*, int, bool)
(tree.c:1979)
==2803==    by 0xD2815E: dump_enumerated_decls(_IO_FILE*, int) (tree-dfa.c:760)
==2803==    by 0xD201CC: (anonymous
namespace)::pass_cleanup_cfg_post_optimizing::execute()
(tree-cfgcleanup.c:1079)
==2803==    by 0xBF3B09: execute_one_pass(opt_pass*) (passes.c:2229)
==2803==    by 0xBF3DA5: execute_pass_list(opt_pass*) (passes.c:2282)
==2803==    by 0x931C98: expand_function(cgraph_node*) (cgraphunit.c:1764)
==2803==    by 0x933BEB: compile() (cgraphunit.c:1898)
==2803==    by 0x9343F4: finalize_compilation_unit() (cgraphunit.c:2319)
==2803==    by 0x71C20E: cp_write_global_declarations() (decl2.c:4431)
==2803==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==2803== 
==2803== Invalid read of size 2
==2803==    at 0x7A87C0: skip_artificial_parms_for(tree_node const*,
tree_node*) (tree.h:2822)
==2803==    by 0x7282E0: dump_function_decl(cxx_pretty_printer*, tree_node*,
int) (error.c:1453)
==2803==    by 0x72A20E: decl_as_string_translate(tree_node*, int)
(error.c:2740)
==2803==    by 0x7DD572: cxx_printable_name_internal(tree_node*, int, bool)
(tree.c:1979)
==2803==    by 0x729872: cp_diagnostic_starter(diagnostic_context*,
diagnostic_info*) (error.c:3081)
==2803==    by 0x15BB688: diagnostic_report_diagnostic(diagnostic_context*,
diagnostic_info*) (diagnostic.c:798)
==2803==    by 0x15BC3EF: internal_error(char const*, ...) (diagnostic.c:1136)
==2803==    by 0xCE85CF: crash_signal(int) (toplev.c:337)
==2803==    by 0x5A592DF: ??? (in /lib64/libc-2.17.so)
==2803==    by 0x7A87BF: skip_artificial_parms_for(tree_node const*,
tree_node*) (method.c:2013)
==2803==    by 0x7282E0: dump_function_decl(cxx_pretty_printer*, tree_node*,
int) (error.c:1453)
==2803==    by 0x72A1A5: decl_as_string(tree_node*, int) (error.c:2732)
==2803==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==2803== 
==2803== 
==2803== Process terminating with default action of signal 11 (SIGSEGV)
==2803==  Access not within mapped region at address 0x0
==2803==    at 0x7A87C0: skip_artificial_parms_for(tree_node const*,
tree_node*) (tree.h:2822)
==2803==    by 0x7282E0: dump_function_decl(cxx_pretty_printer*, tree_node*,
int) (error.c:1453)
==2803==    by 0x72A20E: decl_as_string_translate(tree_node*, int)
(error.c:2740)
==2803==    by 0x7DD572: cxx_printable_name_internal(tree_node*, int, bool)
(tree.c:1979)
==2803==    by 0x729872: cp_diagnostic_starter(diagnostic_context*,
diagnostic_info*) (error.c:3081)
==2803==    by 0x15BB688: diagnostic_report_diagnostic(diagnostic_context*,
diagnostic_info*) (diagnostic.c:798)
==2803==    by 0x15BC3EF: internal_error(char const*, ...) (diagnostic.c:1136)
==2803==    by 0xCE85CF: crash_signal(int) (toplev.c:337)
==2803==    by 0x5A592DF: ??? (in /lib64/libc-2.17.so)
==2803==    by 0x7A87BF: skip_artificial_parms_for(tree_node const*,
tree_node*) (method.c:2013)
==2803==    by 0x7282E0: dump_function_decl(cxx_pretty_printer*, tree_node*,
int) (error.c:1453)
==2803==    by 0x72A1A5: decl_as_string(tree_node*, int) (error.c:2732)
==2803==  If you believe this happened as a result of a stack
==2803==  overflow in your program's main thread (unlikely but
==2803==  possible), you can try to increase the size of the
==2803==  main thread stack using the --main-stacksize= flag.
==2803==  The main thread stack size used in this run was 16777216.
gcc: internal compiler error: Segmentation fault (program valgrind)
0x40d36e execute
        /mnt/svn/gcc-trunk/gcc/gcc.c:2841
0x40d5e9 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:4641
0x410351 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:5924
0x410351 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:5838
0x40dd62 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5295
0x410351 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:5924
0x410351 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:5838
0x40dd62 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5295
0x40d95e do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5410
0x410351 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:5924
0x410351 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:5838
0x40dd62 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5295
0x410351 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:5924
0x410351 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:5838
0x40dd62 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5295
0x410351 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:5924
0x410351 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:5838
0x40dd62 do_spec_1
        /mnt/svn/gcc-trunk/gcc/gcc.c:5295
0x410351 process_brace_body
        /mnt/svn/gcc-trunk/gcc/gcc.c:5924
0x410351 handle_braces
        /mnt/svn/gcc-trunk/gcc/gcc.c:5838
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r207294 - crash
4.8 - unrecognized command line option '-fdeclone-ctor-dtor'

Reply via email to