public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57102] New: [4.9 Regression] ICE: SIGSEGV in fndecl_declared_return_type with -fcompare-debug
@ 2013-04-28 14:23 zsojka at seznam dot cz
  2013-04-29  8:09 ` [Bug c++/57102] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: zsojka at seznam dot cz @ 2013-04-28 14:23 UTC (permalink / raw)
  To: gcc-bugs


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: unassigned@gcc.gnu.org
        ReportedBy: zsojka@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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/57102] [4.9 Regression] ICE: SIGSEGV in fndecl_declared_return_type with -fcompare-debug
  2013-04-28 14:23 [Bug c++/57102] New: [4.9 Regression] ICE: SIGSEGV in fndecl_declared_return_type with -fcompare-debug zsojka at seznam dot cz
@ 2013-04-29  8:09 ` rguenth at gcc dot gnu.org
  2013-05-04 18:48 ` ubizjak at gmail dot com
  2013-05-04 18:50 ` [Bug c++/57102] [4.9 Regression] ICE: SIGSEGV in fndecl_declared_return_type with -fdump-final-insns= ubizjak at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-29  8:09 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/57102] [4.9 Regression] ICE: SIGSEGV in fndecl_declared_return_type with -fcompare-debug
  2013-04-28 14:23 [Bug c++/57102] New: [4.9 Regression] ICE: SIGSEGV in fndecl_declared_return_type with -fcompare-debug zsojka at seznam dot cz
  2013-04-29  8:09 ` [Bug c++/57102] " rguenth at gcc dot gnu.org
@ 2013-05-04 18:48 ` ubizjak at gmail dot com
  2013-05-04 18:50 ` [Bug c++/57102] [4.9 Regression] ICE: SIGSEGV in fndecl_declared_return_type with -fdump-final-insns= ubizjak at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ubizjak at gmail dot com @ 2013-05-04 18:48 UTC (permalink / raw)
  To: gcc-bugs


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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-05-04
     Ever Confirmed|0                           |1

--- Comment #1 from Uros Bizjak <ubizjak at gmail dot com> 2013-05-04 18:48:32 UTC ---
Confirmed, the segfault can be triggered with:

~/gcc-build/gcc/cc1plus -O2 -std=gnu++11 -fno-inline -fdump-final-insns=aaa

The important part is "-fdump-final-insns=...".

...
Performing interprocedural optimizations
 <*free_lang_data> <visibility> <early_local_cleanups> <*free_inline_summary>
<whole-program> <profile_estimate> <cp> <inline> <pure-const>
<static-var>Assembling functions:
 constexpr _Tp&& std::forward(typename std::remove_reference<_Tp>::type&) [with
_Tp = <lambda()>; typename std::remove_reference<_Tp>::type = <lambda()>]
constexpr typename std::remove_reference<_Tp>::type&& std::move(_Tp&&) [with
_Tp = <lambda()>&; typename std::remove_reference<_Tp>::type = <lambda()>]
std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Impl::_Impl(_Alloc) [with _Tp
= std::__future_base::_Task_state<<lambda()>, __gnu_test::SimpleAllocator<int>,
int()>; _Alloc = __gnu_test::SimpleAllocator<int>; __gnu_cxx::_Lock_policy _Lp
= (__gnu_cxx::_Lock_policy)2u] std::function<_Res(_ArgTypes
...)>::function(_Functor) [with _Functor =
std::reference_wrapper<std::_Bind_simple<std::reference_wrapper<<lambda()> >()>
>; <template-parameter-2-2> = void; _Res = int; _ArgTypes = {}]
final.ii:765:61: internal compiler error: Segmentation fault
 packaged_task<int()> p(allocator_arg, a, []() { return 1; });
                                                             ^
0xa94bff crash_signal
        ../../gcc-svn/trunk/gcc/toplev.c:333
0x54160b fndecl_declared_return_type(tree_node*)
        ../../gcc-svn/trunk/gcc/cp/decl.c:14388
0x5f620c dump_function_decl
        ../../gcc-svn/trunk/gcc/cp/error.c:1416
0x5f7b40 decl_as_string(tree_node*, int)
        ../../gcc-svn/trunk/gcc/cp/error.c:2642
0x69f562 cxx_printable_name_internal
        ../../gcc-svn/trunk/gcc/cp/tree.c:1953
0xa95312 announce_function(tree_node*)
        ../../gcc-svn/trunk/gcc/toplev.c:229
0x7c26f6 expand_function
        ../../gcc-svn/trunk/gcc/cgraphunit.c:1610
0x7c44d6 expand_all_functions
        ../../gcc-svn/trunk/gcc/cgraphunit.c:1744
0x7c44d6 compile()
        ../../gcc-svn/trunk/gcc/cgraphunit.c:2042
0x7c4b79 finalize_compilation_unit()
        ../../gcc-svn/trunk/gcc/cgraphunit.c:2119
0x5ea280 cp_write_global_declarations()
        ../../gcc-svn/trunk/gcc/cp/decl2.c:4330
Please submit a full bug report,

It looks that compilation fails during IPO, trying to dump fndecl.

gdb says:

Program received signal SIGSEGV, Segmentation fault.
0x000000000054160b in fndecl_declared_return_type (fn=0x7ffff165ad00) at
../../gcc-svn/trunk/gcc/cp/decl.c:14388
14388               ->x_auto_return_pattern);

(gdb) bt
#0  0x000000000054160b in fndecl_declared_return_type (fn=0x7ffff165ad00) at
../../gcc-svn/trunk/gcc/cp/decl.c:14388
#1  0x00000000005f620d in dump_function_decl (t=0x7ffff165ad00, flags=4) at
../../gcc-svn/trunk/gcc/cp/error.c:1416
#2  0x00000000005f7b41 in decl_as_string (decl=0x7ffff165ad00, flags=4) at
../../gcc-svn/trunk/gcc/cp/error.c:2642
#3  0x000000000069f563 in cxx_printable_name_internal (decl=0x7ffff165ad00,
v=2, translate=<optimized out>) at ../../gcc-svn/trunk/gcc/cp/tree.c:1953
#4  0x0000000000b2a8f9 in dump_function_header (dump_file=0x17cb5a0,
fdecl=0x7ffff165ad00, flags=0) at
../../gcc-svn/trunk/gcc/tree-pretty-print.c:3138
#5  0x000000000087f4b1 in rest_of_clean_state () at
../../gcc-svn/trunk/gcc/final.c:4455
#6  0x00000000009f846f in execute_one_pass (pass=pass@entry=0x1639380
<pass_clean_state>) at ../../gcc-svn/trunk/gcc/passes.c:2337

(gdb) list
14383   fndecl_declared_return_type (tree fn)
14384   {
14385     fn = STRIP_TEMPLATE (fn);
14386     if (FNDECL_USED_AUTO (fn))
14387       return (DECL_STRUCT_FUNCTION (fn)->language
14388               ->x_auto_return_pattern);
14389     else
14390       return TREE_TYPE (TREE_TYPE (fn));
14391   }
14392


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/57102] [4.9 Regression] ICE: SIGSEGV in fndecl_declared_return_type with -fdump-final-insns=...
  2013-04-28 14:23 [Bug c++/57102] New: [4.9 Regression] ICE: SIGSEGV in fndecl_declared_return_type with -fcompare-debug zsojka at seznam dot cz
  2013-04-29  8:09 ` [Bug c++/57102] " rguenth at gcc dot gnu.org
  2013-05-04 18:48 ` ubizjak at gmail dot com
@ 2013-05-04 18:50 ` ubizjak at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: ubizjak at gmail dot com @ 2013-05-04 18:50 UTC (permalink / raw)
  To: gcc-bugs


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

Uros Bizjak <ubizjak at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[4.9 Regression] ICE:       |[4.9 Regression] ICE:
                   |SIGSEGV in                  |SIGSEGV in
                   |fndecl_declared_return_type |fndecl_declared_return_type
                   |with -fcompare-debug        |with -fdump-final-insns=...

--- Comment #2 from Uros Bizjak <ubizjak at gmail dot com> 2013-05-04 18:50:10 UTC ---
Updated Summary.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-04 18:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-28 14:23 [Bug c++/57102] New: [4.9 Regression] ICE: SIGSEGV in fndecl_declared_return_type with -fcompare-debug zsojka at seznam dot cz
2013-04-29  8:09 ` [Bug c++/57102] " rguenth at gcc dot gnu.org
2013-05-04 18:48 ` ubizjak at gmail dot com
2013-05-04 18:50 ` [Bug c++/57102] [4.9 Regression] ICE: SIGSEGV in fndecl_declared_return_type with -fdump-final-insns= ubizjak at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).