https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117152

--- Comment #4 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
It's happening here:

(gdb) bt
#0  0x0000000000f95395 in dump_function_name (pp=0x4d00c40
<actual_pretty_printer>, t=<function_decl 0x7fffea7fc100 __ct >, flags=148)
    at ../../src/gcc/cp/error.cc:2139
#1  0x0000000000f94109 in dump_function_decl (pp=0x4d00c40
<actual_pretty_printer>, t=<function_decl 0x7fffea7fc100 __ct >, flags=148)
    at ../../src/gcc/cp/error.cc:1943
#2  0x0000000000f910ab in dump_decl (pp=0x4d00c40 <actual_pretty_printer>,
t=<function_decl 0x7fffea7fc100 __ct >, flags=148)
    at ../../src/gcc/cp/error.cc:1534
#3  0x0000000000f9bd68 in decl_to_string (decl=<function_decl 0x7fffea7fc100
__ct >, verbose=0, show_color=true) at ../../src/gcc/cp/error.cc:3429
#4  0x0000000000fa045e in cp_printer (pp=0x4f3fd80, text=0x7fffffffc7e0,
spec=0x4f57651 "D", precision=0, wide=false, set_locus=false, 
    verbose=false, quoted=0x7fffffffc4cf, formatted_token_list=...) at
../../src/gcc/cp/error.cc:4644
#5  0x0000000003c40dd9 in format_phase_2 (pp=0x4f3fd80, text=...,
chunk_obstack=..., formatters=0x7fffffffc600)
    at ../../src/gcc/pretty-print.cc:2101
#6  0x0000000003c3e769 in pretty_printer::format (this=0x4f3fd80, text=...) at
../../src/gcc/pretty-print.cc:1654
#7  0x00000000015276af in pp_format (pp=0x4f3fd80, text=0x7fffffffc7e0) at
../../src/gcc/pretty-print.h:589
#8  0x0000000003be245e in diagnostic_context::report_diagnostic (this=0x4eee500
<global_diagnostic_context>, diagnostic=0x7fffffffc7e0)
    at ../../src/gcc/diagnostic.cc:1314
#9  0x0000000003be286f in diagnostic_context::diagnostic_impl (this=0x4eee500
<global_diagnostic_context>, richloc=0x7fffffffc8b0, metadata=0x0, 
    option_id=..., gmsgid=0x3d34178 "friend declaration of %qD specifies
default arguments and isn%'t a definition", ap=0x7fffffffc978, 
    kind=DK_PERMERROR) at ../../src/gcc/diagnostic.cc:1427
#10 0x0000000003c0e2d7 in permerror (location=251397, 
    gmsgid=0x3d34178 "friend declaration of %qD specifies default arguments and
isn%'t a definition")
    at ../../src/gcc/diagnostic-global-context.cc:329

due to:

2139          if (LAMBDA_TYPE_P (DECL_CONTEXT (t)))

here:

(gdb) list
2134    
2135      /* Don't let the user see __comp_ctor et al.  */
2136      if (DECL_CONSTRUCTOR_P (t)
2137          || DECL_DESTRUCTOR_P (t))
2138        {
2139          if (LAMBDA_TYPE_P (DECL_CONTEXT (t)))
2140            name = get_identifier ("<lambda>");
2141          else if (TYPE_UNNAMED_P (DECL_CONTEXT (t)))
2142            name = get_identifier ("<constructor>");
2143          else

where:

(gdb) p t
$3 = <function_decl 0x7fffea7fc100 __ct >

#define DECL_CONTEXT(NODE) (DECL_MINIMAL_CHECK (NODE)->decl_minimal.context)

(gdb) p t->decl_minimal.context
$5 = <tree 0x0>

and thus LAMBDA_TYPE_P (DECL_CONTEXT (t)) is a read through NULL.

(gdb) pt t
 <function_decl 0x7fffea7fc100 __ct 
    type <method_type 0x7fffea8100a8
        type <void_type 0x7fffea669f18 void VOID
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffea669f18
            pointer_to_this <pointer_type 0x7fffea670000>>
        QI
        size <integer_cst 0x7fffea662330 constant 8>
        unit-size <integer_cst 0x7fffea662348 constant 1>
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffea810150 method basetype <record_type 0x7fffea7f9f18 S>
        arg-types <tree_list 0x7fffea80f0a0 value <pointer_type 0x7fffea7f9498>
            chain <tree_list 0x7fffea80f050
                purpose <constructor 0x7fffea8084c8 type <lang_type
0x7fffea7f6000 init list>
                    constant length:1
                    val <non_lvalue_expr 0x7fffea7e6f80 type <integer_type
0x7fffea6695e8 int>
                        constant public
                        arg:0 <integer_cst 0x7fffea6625d0 constant 0>
                       
../../src/gcc/testsuite/g++.dg/diagnostic/pr117152.C:3:44 start:
../../src/gcc/testsuite/g++.dg/diagnostic/pr117152.C:3:44 finish:
../../src/gcc/testsuite/g++.dg/diagnostic/pr117152.C:3:44>> value
<reference_type 0x7fffea7f93f0>
                chain <tree_list 0x7fffea65dd98 value <void_type 0x7fffea669f18
void>>>>
        throws <tree_list 0x7fffea7f3730
            purpose <integer_cst 0x7fffea6625b8 constant 1>>>
    QI ../../src/gcc/testsuite/g++.dg/diagnostic/pr117152.C:3:22 align:16
warn_if_not_align:0

Program received signal SIGSEGV, Segmentation fault.
0x0000000000f95395 in dump_function_name (pp=0x4d00c40 <actual_pretty_printer>,
t=<function_decl 0x7fffea7fc100 __ct >, flags=116)
    at ../../src/gcc/cp/error.cc:2139
2139          if (LAMBDA_TYPE_P (DECL_CONTEXT (t)))
The program being debugged was signaled while in a function called from GDB.
GDB has restored the context to what it was before the call.
To change this behavior use "set unwindonsignal off".
Evaluation of the expression containing the function
(debug_tree(tree_node*)) will be abandoned.


Jonathan: are you sure about the bisection to r15-1635?  I'm not sure how
r15-1635 could have caused this, but it perhaps could have changed what
backtraces look like (e.g. if there's a second ICE whilst already handling an
ICE, maybe)

Reply via email to