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



             Bug #: 57102

           Summary: [4.9 Regression] ICE: SIGSEGV in

                    fndecl_declared_return_type with -fcompare-debug

    Classification: Unclassified

           Product: gcc

           Version: 4.9.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: zso...@seznam.cz





Created attachment 29963

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29963

partially reduced testcase



Might be related to PR57101.



Command line:

$ gcc -O2 -std=gnu++0x -fno-inline -fcompare-debug final.ii



Compiler output:

$ gcc -O2 -std=gnu++0x -fno-inline -fcompare-debug final.ii -wrapper

valgrind,-q,--num-callers=40,--track-origins=yes

final.ii:7:14: warning: inline function 'void* operator new(std::size_t,

void*)' used but never defined [enabled by default]

 inline void* operator new(std::size_t, void* __p) noexcept

              ^

final.ii:310:5: warning: inline function 'constexpr typename

std::__add_ref<typename std::tuple_element<__i, std::tuple<_Elements ...>

>::type>::type std::get(std::tuple<_Elements ...>&) [with long unsigned int __i

= 0ul; _Elements = {std::reference_wrapper<<lambda()> >}; typename

std::__add_ref<typename std::tuple_element<__i, std::tuple<_Elements ...>

>::type>::type = std::reference_wrapper<<lambda()> >&]' used but never defined

[enabled by default]

     get(tuple<_Elements...>& __t) noexcept

     ^

==19688== Invalid read of size 8

==19688==    at 0x5DBFEB: fndecl_declared_return_type(tree_node*)

(decl.c:14388)

==19688==    by 0x690DCC: dump_function_decl(tree_node*, int) (error.c:1416)

==19688==    by 0x692700: decl_as_string(tree_node*, int) (error.c:2642)

==19688==    by 0x739FA2: cxx_printable_name_internal(tree_node*, int, bool)

(tree.c:1953)

==19688==    by 0xC72698: dump_function_header(_IO_FILE*, tree_node*, int)

(tree-pretty-print.c:3138)

==19688==    by 0x950DBF: rest_of_clean_state() (final.c:4455)

==19688==    by 0xAF233E: execute_one_pass(opt_pass*) (passes.c:2337)

==19688==    by 0xAF2764: execute_pass_list(opt_pass*) (passes.c:2389)

==19688==    by 0x86F1B1: expand_function(cgraph_node*) (cgraphunit.c:1640)

==19688==    by 0x870EF6: compile() (cgraphunit.c:1744)

==19688==    by 0x871599: finalize_compilation_unit() (cgraphunit.c:2119)

==19688==    by 0x684E50: cp_write_global_declarations() (decl2.c:4330)

==19688==    by 0xBDD0DC: compile_file() (toplev.c:558)

==19688==    by 0xBDEF07: toplev_main(int, char**) (toplev.c:1872)

==19688==    by 0x5A3C60C: (below main) (in /lib64/libc-2.15.so)

==19688==  Address 0x50 is not stack'd, malloc'd or (recently) free'd

==19688== 

==19688== Invalid read of size 8

==19688==    at 0x5DBFEB: fndecl_declared_return_type(tree_node*)

(decl.c:14388)

==19688==    by 0x690DCC: dump_function_decl(tree_node*, int) (error.c:1416)

==19688==    by 0x692759: decl_as_string_translate(tree_node*, int)

(error.c:2650)

==19688==    by 0x739FA2: cxx_printable_name_internal(tree_node*, int, bool)

(tree.c:1953)

==19688==    by 0x691C52: cp_diagnostic_starter(diagnostic_context*,

diagnostic_info*) (error.c:2989)

==19688==    by 0x136F722: diagnostic_report_diagnostic(diagnostic_context*,

diagnostic_info*) (diagnostic.c:788)

==19688==    by 0x137056F: internal_error(char const*, ...) (diagnostic.c:1126)

==19688==    by 0xBDD06F: crash_signal(int) (toplev.c:333)

==19688==    by 0x5A4FC8F: ??? (in /lib64/libc-2.15.so)

==19688==    by 0x5DBFEA: fndecl_declared_return_type(tree_node*)

(decl.c:14388)

==19688==    by 0x690DCC: dump_function_decl(tree_node*, int) (error.c:1416)

==19688==    by 0x692700: decl_as_string(tree_node*, int) (error.c:2642)

==19688==    by 0x739FA2: cxx_printable_name_internal(tree_node*, int, bool)

(tree.c:1953)

==19688==    by 0xC72698: dump_function_header(_IO_FILE*, tree_node*, int)

(tree-pretty-print.c:3138)

==19688==    by 0x950DBF: rest_of_clean_state() (final.c:4455)

==19688==    by 0xAF233E: execute_one_pass(opt_pass*) (passes.c:2337)

==19688==    by 0xAF2764: execute_pass_list(opt_pass*) (passes.c:2389)

==19688==    by 0x86F1B1: expand_function(cgraph_node*) (cgraphunit.c:1640)

==19688==    by 0x870EF6: compile() (cgraphunit.c:1744)

==19688==    by 0x871599: finalize_compilation_unit() (cgraphunit.c:2119)

==19688==    by 0x684E50: cp_write_global_declarations() (decl2.c:4330)

==19688==    by 0xBDD0DC: compile_file() (toplev.c:558)

==19688==    by 0xBDEF07: toplev_main(int, char**) (toplev.c:1872)

==19688==    by 0x5A3C60C: (below main) (in /lib64/libc-2.15.so)

==19688==  Address 0x50 is not stack'd, malloc'd or (recently) free'd

==19688== 

==19688== 

==19688== Process terminating with default action of signal 11 (SIGSEGV)

==19688==  Access not within mapped region at address 0x50

==19688==    at 0x5DBFEB: fndecl_declared_return_type(tree_node*)

(decl.c:14388)

==19688==    by 0x690DCC: dump_function_decl(tree_node*, int) (error.c:1416)

==19688==    by 0x692759: decl_as_string_translate(tree_node*, int)

(error.c:2650)

==19688==    by 0x739FA2: cxx_printable_name_internal(tree_node*, int, bool)

(tree.c:1953)

==19688==    by 0x691C52: cp_diagnostic_starter(diagnostic_context*,

diagnostic_info*) (error.c:2989)

==19688==    by 0x136F722: diagnostic_report_diagnostic(diagnostic_context*,

diagnostic_info*) (diagnostic.c:788)

==19688==    by 0x137056F: internal_error(char const*, ...) (diagnostic.c:1126)

==19688==    by 0xBDD06F: crash_signal(int) (toplev.c:333)

==19688==    by 0x5A4FC8F: ??? (in /lib64/libc-2.15.so)

==19688==    by 0x5DBFEA: fndecl_declared_return_type(tree_node*)

(decl.c:14388)

==19688==    by 0x690DCC: dump_function_decl(tree_node*, int) (error.c:1416)

==19688==    by 0x692700: decl_as_string(tree_node*, int) (error.c:2642)

==19688==    by 0x739FA2: cxx_printable_name_internal(tree_node*, int, bool)

(tree.c:1953)

==19688==    by 0xC72698: dump_function_header(_IO_FILE*, tree_node*, int)

(tree-pretty-print.c:3138)

==19688==    by 0x950DBF: rest_of_clean_state() (final.c:4455)

==19688==    by 0xAF233E: execute_one_pass(opt_pass*) (passes.c:2337)

==19688==    by 0xAF2764: execute_pass_list(opt_pass*) (passes.c:2389)

==19688==    by 0x86F1B1: expand_function(cgraph_node*) (cgraphunit.c:1640)

==19688==    by 0x870EF6: compile() (cgraphunit.c:1744)

==19688==    by 0x871599: finalize_compilation_unit() (cgraphunit.c:2119)

==19688==    by 0x684E50: cp_write_global_declarations() (decl2.c:4330)

==19688==    by 0xBDD0DC: compile_file() (toplev.c:558)

==19688==    by 0xBDEF07: toplev_main(int, char**) (toplev.c:1872)

==19688==    by 0x5A3C60C: (below main) (in /lib64/libc-2.15.so)

==19688==  If you believe this happened as a result of a stack

==19688==  overflow in your program's main thread (unlikely but

==19688==  possible), you can try to increase the size of the

==19688==  main thread stack using the --main-stacksize= flag.

==19688==  The main thread stack size used in this run was 16777216.

gcc: internal compiler error: Segmentation fault (program valgrind)



Tested revisions:

r198366 - crash

4.8 r198018 - -fcompare-debug failure

4.7 r198018 - ICE: Error reporting routines re-entered.

Reply via email to