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

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
Reduced C++ code is

typedef int mbstate_t;
namespace std {
struct Trans_NS___cxx11_basic_string {
  char *c_str();
};
template <typename _Facet> _Facet use_facet(int);
template <typename _ExternT> struct __codecvt_abstract_base {
  typedef _ExternT extern_type;
  int length(int, extern_type *, const extern_type *, long);
};
template <typename, typename _ExternT, typename>
struct codecvt : __codecvt_abstract_base<_ExternT> {};
} // namespace std
template <class T> struct intrusive_ptr {
  intrusive_ptr(T *);
  T *operator->();
};
long attach___trans_tmp_3;
struct basic_ostringstreambuf {
  struct {
    std::Trans_NS___cxx11_basic_string storage;
    long max_size;
  } m_storage_state;
  void attach() {
    attach___trans_tmp_3 = 9223372036854775807 / 2;
    long size = attach___trans_tmp_3;
    m_storage_state.max_size = size;
    length_until_boundary(m_storage_state.storage.c_str(),
                          m_storage_state.max_size);
  }
  void length_until_boundary(char *s, long max_size) {
    int loc;
    std::codecvt fac =
        std::use_facet<std::codecvt<wchar_t, char, mbstate_t>>(loc);
    mbstate_t mbs(fac.length(mbs, s, s + max_size, 0));
  }
};
struct Trans_NS_v2_mt_posix_basic_formatting_ostream {
  basic_ostringstreambuf m_streambuf;
  void attach(std::Trans_NS___cxx11_basic_string) { m_streambuf.attach(); }
};
template <typename>
struct Trans_NS_v2_mt_posix_basic_record_ostream
    : Trans_NS_v2_mt_posix_basic_formatting_ostream {
  typedef std::Trans_NS___cxx11_basic_string string_type;
  void init_stream();
};
struct attribute_value_impl {
  attribute_value_impl(std::Trans_NS___cxx11_basic_string);
  std::Trans_NS___cxx11_basic_string get();
};
template <typename CharT>
void Trans_NS_v2_mt_posix_basic_record_ostream<CharT>::init_stream() {
  typedef attribute_value_impl message_impl_type;
  intrusive_ptr p = new message_impl_type(string_type());
  attach(p->get());
}
template class Trans_NS_v2_mt_posix_basic_record_ostream<char>;

I will have a go at a git bisect in the morning.

Reply via email to