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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
cp_tree_equal is called on
 <tree_vec 0x7fffe9411cf8 length:2 elt:0 <ggc_freed 0x7fffe99f3e88>
    elt:1 <integer_cst 0x7fffe981ba68 type <integer_type 0x7fffe98235e8 int>
constant 4>>
and
 <tree_vec 0x7fffe9411d98 length:2
    elt:0 <constructor 0x7fffe99f3ee8
        type <record_type 0x7fffe99fa498 ._anon_5 cxx-odr-p type_5 type_6 QI
            size <integer_cst 0x7fffe981b3c0 constant 8>
            unit-size <integer_cst 0x7fffe981b3d8 constant 1>
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffe99fa498 fields <function_decl 0x7fffe99fbf00 __ct > context
<function_decl 0x7fffe99ce300 main>
            full-name "struct main()::<lambda(this auto:6, int)>"
            X() X(constX&) this=(X&) n_parents=0 use_template=0
interface-unknown
            pointer_to_this <pointer_type 0x7fffe99faa80> reference_to_this
<reference_type 0x7fffe99fac78> chain <type_decl 0x7fffe99f45a0 ._anon_5>>
        constant length:0>
    elt:1 <integer_cst 0x7fffe981ba68 type <integer_type 0x7fffe98235e8 int>
constant 4>>

The ggc_freed tree elt is the problem, 42405 is 0xa5a5...
It was allocated in
#0  0x00007ffff7a108a6 in __memset_evex_unaligned () from /lib64/libc.so.6
#1  0x0000000000a650d8 in ggc_internal_alloc_ (size=24, f=0x0, s=0, n=1) at
../../gcc/ggc-page.cc:1480
#2  0x000000000061b435 in ggc_internal_alloc (s=24) at ../../gcc/ggc.h:141
#3  0x000000000177264c in ggc_alloc_tree_node_stat (s=24) at
../../gcc/ggc.h:332
#4  0x000000000172b4fd in copy_node (node=<constructor 0x7fffe99f3e70>) at
../../gcc/tree.cc:1478
#5  0x000000000048d95b in unshare_constructor (t=<constructor 0x7fffe99f3e70>)
at ../../gcc/cp/constexpr.cc:2759
#6  0x000000000049543b in cxx_eval_call_expression (ctx=0x7fffffffb6f0,
t=<call_expr 0x7fffe9408cc0>, lval=vc_prvalue, non_constant_p=0x7fffffffbedf,
overflow_p=0x7fffffffbede, 
    jump_target=0x7fffffffbca8) at ../../gcc/cp/constexpr.cc:4456
#7  0x00000000004aaeb5 in cxx_eval_constant_expression (ctx=0x7fffffffbd70,
t=<call_expr 0x7fffe9408cc0>, lval=vc_prvalue, non_constant_p=0x7fffffffbedf,
overflow_p=0x7fffffffbede, 
    jump_target=0x7fffffffbca8) at ../../gcc/cp/constexpr.cc:9353
#8  0x00000000004b2ede in cxx_eval_outermost_constant_expr (t=<call_expr
0x7fffe9408cc0>, allow_non_constant=true, strict=true,
manifestly_const_eval=mce_value::mce_unknown, 
    constexpr_dtor=false, object=<tree 0x0>) at ../../gcc/cp/constexpr.cc:10946
#9  0x00000000004b4870 in maybe_constant_value (t=<call_expr 0x7fffe9408cc0>,
decl=<tree 0x0>, manifestly_const_eval=mce_value::mce_unknown) at
../../gcc/cp/constexpr.cc:11402
#10 0x00000000005ec403 in fold_for_warn (x=<call_expr 0x7fffe9408c80>) at
../../gcc/cp/expr.cc:438
and freed in
#0  0x00007ffff7a108a6 in __memset_evex_unaligned () from /lib64/libc.so.6
#1  0x0000000000a6555d in ggc_free (p=0x7fffe99f3e88) at
../../gcc/ggc-page.cc:1734
#2  0x000000000048db97 in free_constructor (t=<ggc_freed 0x7fffe99f3e88>) at
../../gcc/cp/constexpr.cc:2791
#3  0x0000000000495eef in cxx_eval_call_expression (ctx=0x7fffffffb6f0,
t=<call_expr 0x7fffe9408cc0>, lval=vc_prvalue, non_constant_p=0x7fffffffbedf,
overflow_p=0x7fffffffbede, 
    jump_target=0x7fffffffbca8) at ../../gcc/cp/constexpr.cc:4568
#4  0x00000000004aaeb5 in cxx_eval_constant_expression (ctx=0x7fffffffbd70,
t=<call_expr 0x7fffe9408cc0>, lval=vc_prvalue, non_constant_p=0x7fffffffbedf,
overflow_p=0x7fffffffbede, 
    jump_target=0x7fffffffbca8) at ../../gcc/cp/constexpr.cc:9353
#5  0x00000000004b2ede in cxx_eval_outermost_constant_expr (t=<call_expr
0x7fffe9408cc0>, allow_non_constant=true, strict=true,
manifestly_const_eval=mce_value::mce_unknown, 
    constexpr_dtor=false, object=<tree 0x0>) at ../../gcc/cp/constexpr.cc:10946
#6  0x00000000004b4870 in maybe_constant_value (t=<call_expr 0x7fffe9408cc0>,
decl=<tree 0x0>, manifestly_const_eval=mce_value::mce_unknown) at
../../gcc/cp/constexpr.cc:11402
#7  0x00000000005ec403 in fold_for_warn (x=<call_expr 0x7fffe9408c80>) at
../../gcc/cp/expr.cc:438
which is
          /* Free any parameter CONSTRUCTORs we aren't returning directly.  */
          while (!ctors->is_empty ())
            {
              tree c = ctors->pop ();
              if (c != result)
                free_constructor (c);
            }
so the question is where it made the constexpr call cache in between.

Reply via email to