[Bug c++/84684] inserting random code / flags produces wrong code
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Mar 5 14:25:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84684
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
In the debugger when looking at cxx_eval_call_expression
union_composition<0, dna4>::value_to_char_helper<4, dna4> (TARGET_EXPR
<D.34562, {}>);
I see:
(gdb) p debug_generic_stmt (result)
{._M_elems={65, 67, 67, 84}}
which is 'A', 'C', 'C', 'T'.
When doing cxx_eval_call_expression for the 3rd invocation of:
to_char<dna4> (TARGET_EXPR <D.34725, *(const struct dna4 &) dna4::assign_rank
(&alphabet, (int) (uint8_t) i)>);
(i.e. when alphabet PARM_DECL has the current value of {._value=2}), we somehow
find it in the hash table:
1598 constexpr_call *entry = NULL;
1599 if (depth_ok && !non_constant_args && ctx->strict)
1600 {
1601 new_call.hash = iterative_hash_template_arg
1602 (new_call.bindings, constexpr_fundef_hasher::hash
(new_call.fundef));
1603
1604 /* If we have seen this call before, we are done. */
1605 maybe_initialize_constexpr_call_table ();
1606 constexpr_call **slot
1607 = constexpr_call_table->find_slot (&new_call, INSERT);
1608 entry = *slot;
(i.e. entry is non-NULL) and actually use the cached result instead of
evaluating it again.
debug_tree (new_call.bindings)
<tree_list 0x7fffee728780
purpose <parm_decl 0x7fffee712a00 alph
type <record_type 0x7fffee6d8738 dna4 readonly type_5 QI
size <integer_cst 0x7fffefc45f60 constant 8>
unit-size <integer_cst 0x7fffefc45f78 constant 1>
align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffee6d8738 fields <function_decl 0x7fffee713a00 __ct > context
<translation_unit_decl 0x7fffefc52168 pr84684-7.ii>
full-name "const struct dna4"
X() X(constX&) this=(X&) n_parents=0 use_template=0
interface-unknown
pointer_to_this <pointer_type 0x7fffee6d8888> reference_to_this
<reference_type 0x7fffee714540>>
readonly addressable used read QI pr84684-6.C:5:44 size <integer_cst
0x7fffefc45f60 8> unit-size <integer_cst 0x7fffefc45f78 1>
align:8 warn_if_not_align:0 context <function_decl 0x7fffee713300
to_char>
arg-type <record_type 0x7fffee6d8738 dna4>>
value <constructor 0x7fffee727468 type <record_type 0x7fffee6d8738 dna4>
constant length:1
idx <field_decl 0x7fffee6d45f0 _value type <integer_type 0x7fffef1a41f8
uint8_t>
used unsigned nonlocal decl_3 QI pr84684-6.C:67:11 size
<integer_cst 0x7fffefc45f60 8> unit-size <integer_cst 0x7fffefc45f78 1>
align:8 warn_if_not_align:0 offset_align 128
offset <integer_cst 0x7fffefc45ea0 constant 0>
bit-offset <integer_cst 0x7fffefc45ee8 constant 0> context
<record_type 0x7fffee6d8540 dna4> chain <type_decl 0x7fffee6d4558 dna4>>
val <integer_cst 0x7fffee727438 constant 2>>>
More information about the Gcc-bugs
mailing list