------- Comment #12 from rguenth at gcc dot gnu dot org  2009-08-28 09:57 
-------
Instantiating

_ZN10__gnu_pbds13gp_hash_tableINS_4test10basic_typeES2_NS1_4hashESt8equal_toIS2_ENS1_27direct_mod_range_hashing_t_IN9__gnu_cxx15throw_allocatorIS2_EEEENS1_21quadratic_probe_fn_t_IS2_S9_EENS_27hash_standard_resize_policyINS1_25hash_prime_size_policy_t_ENS1_33hash_load_check_resize_trigger_t_IS9_Lj1ELj8ELj1ELj2ELb1EEELb1EjEELb0ES9_EaSERKSI_

tmpD.97537.D.92388.D.92047.D.91561.D.91103.D.89988.D.89882._vptr.hash_load_check_resize_triggerD.89847
other.1162D.116069_22 = (struct equal_toD.83779 *)
&tmpD.97537.D.92388.D.92047.D.91561;
*this.1163D.116068_23 = *other.1162D.116069_22;

Dissecting the types of
tmpD.97537.D.92388.D.92047.D.91561.D.91103.D.89988.D.89882._vptr.hash_load_check_resize_triggerD.89847:

<record_type 0xb55beaf0 gp_hash_table
    fields <field_decl 0xb52cef60 D.92388
            type <record_type 0xb525f540 basic_hash_table
            offset <integer_cst 0xb7c9a310 0> bit offset <integer_cst
0xb7c9a7e0 0>

<record_type 0xb525f540 basic_hash_table
    fields <field_decl 0xb52cede0 D.92047
            type <record_type 0xb5266c40 container_base>
            offset <integer_cst 0xb7c9a310 0> bit offset <integer_cst
0xb7c9a7e0 0>

<record_type 0xb5266c40 container_base
    fields <field_decl 0xb52cec60 D.91561
            type <record_type 0xb527a000 gp_ht_map_data_
            offset <integer_cst 0xb7c9a310 0> bit offset <integer_cst
0xb7c9a7e0 0>

<record_type 0xb527a000 gp_ht_map_data_
    fields <field_decl 0xb52ce6c0 D.91103
            type <record_type 0xb5555e00 hash_standard_resize_policy
            offset <integer_cst 0xb7c9a310 0> bit offset <integer_cst
0xb7c9a7e0 0>

record_type 0xb5555e00 hash_standard_resize_policy
    fields <field_decl 0xb528b360 D.89988
           type <record_type 0xb567ebd0 hash_load_check_resize_trigger_t_
           offset <integer_cst 0xb7c9a310 0> bit offset <integer_cst 0xb7c9a7e0
0>

<record_type 0xb567ebd0 hash_load_check_resize_trigger_t_
     fields <field_decl 0xb528b180 D.89882
            type <record_type 0xb527f2a0 hash_load_check_resize_trigger
            offset <integer_cst 0xb7c9a310 0> bit offset <integer_cst
0xb7c9a7e0 0>

<record_type 0xb527f2a0 hash_load_check_resize_trigger
     fields <field_decl 0xb526ad20 _vptr.hash_load_check_resize_trigger
            type <pointer_type 0xb7d80e00 type <pointer_type 0xb7d80cb0
__vtbl_ptr_type>
            offset <integer_cst 0xb7c9a310 0> bit offset <integer_cst
0xb7c9a7e0 0>


Shows that
other.1162D.116069_22 = (struct equal_toD.83779 *)
&tmpD.97537.D.92388.D.92047.D.91561;

takes the address of gp_ht_map_data_.  There is no equal_to typed field in
this struct.

So the question boils down to who is responsible for the std::swap of this
"field" and how do we end up with this code.

It seems to be

_ZN10__gnu_pbds6detail15gp_ht_map_data_INS_4test10basic_typeES3_NS2_4hashESt8equal_toIS3_EN9__gnu_cxx15throw_allocatorIS3_EELb0ENS2_27direct_mod_range_hashing_t_IS9_EENS2_21quadratic_probe_fn_t_IS3_S9_EENS_27hash_standard_resize_policyINS2_25hash_prime_size_policy_t_ENS2_33hash_load_check_resize_trigger_t_IS9_Lj1ELj8ELj1ELj2ELb1EEELb1EjEEE4swapERSJ_

calling
  other.1158D.107162 = (const struct hash_eq_fnD.89704 *) otherD.90715;
  this.1159D.107163 = (struct hash_eq_fnD.89704 *) thisD.90714;
 
_ZN10__gnu_pbds6detail10hash_eq_fnINS_4test10basic_typeESt8equal_toIS3_EN9__gnu_cxx15throw_allocatorIS3_EELb0EE4swapERKS9_D.89731
(this.1159D.107163, other.1158D.107162);

;; Function swap
(_ZN10__gnu_pbds6detail10hash_eq_fnINS_4test10basic_typeESt8equal_toIS3_EN9__gnu_cxx15throw_allocatorIS3_EELb0EE4swapERKS9_)

swap (struct hash_eq_fnD.89704 * const thisD.89732, const struct
hash_eq_fnD.89704 & otherD.89733)
{
  struct equal_toD.83779 * this.1163D.107177;
  struct equal_toD.83779 * other.1162D.107176;

  <bb 2>:
      other.1162D.107176 = (struct equal_toD.83779 *) otherD.89733;
  this.1163D.107177 = (struct equal_toD.83779 *) thisD.89732;
  _ZSt4swapISt8equal_toIN10__gnu_pbds4test10basic_typeEEEvRT_S6_D.99289
(this.1163D.107177, other.1162D.107176);
  return;

}

ext/pb_ds/detail/gp_hash_table_map_/constructor_destructor_fn_imps.hpp:

PB_DS_CLASS_T_DEC
void
PB_DS_CLASS_C_DEC::
swap(PB_DS_CLASS_C_DEC& other)
{
  _GLIBCXX_DEBUG_ONLY(assert_valid());
  _GLIBCXX_DEBUG_ONLY(other.assert_valid());
  std::swap(m_num_e, other.m_num_e);
  std::swap(m_num_used_e, other.m_num_used_e);
  std::swap(m_entries, other.m_entries);
  ranged_probe_fn_base::swap(other);
  hash_eq_fn_base::swap(other);
  resize_base::swap(other);
  _GLIBCXX_DEBUG_ONLY(debug_base::swap(other));
  _GLIBCXX_DEBUG_ONLY(assert_valid());
  _GLIBCXX_DEBUG_ONLY(other.assert_valid());
}

where hash_eq_fn_base::swap(other); is the culprit.

ext/pb_ds/detail/eq_fn/hash_eq_fn.hpp:

PB_DS_CLASS_T_DEC
inline void
PB_DS_CLASS_C_DEC::
swap(const PB_DS_CLASS_C_DEC& other)
{ std::swap((Eq_Fn& )(*this), (Eq_Fn& )other); }

WTF?


-- 


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

Reply via email to