public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dcb314 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/108278] runtime error with -O1 -Wall
Date: Tue, 03 Jan 2023 22:17:38 +0000	[thread overview]
Message-ID: <bug-108278-4-gn71sGm94r@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108278-4@http.gcc.gnu.org/bugzilla/>

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	other threads:[~2023-01-03 22:17 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-03 18:52 [Bug c++/108278] New: " dcb314 at hotmail dot com
2023-01-03 22:17 ` dcb314 at hotmail dot com [this message]
2023-01-04  0:54 ` [Bug middle-end/108278] [13 Regression] " pinskia at gcc dot gnu.org
2023-01-04  1:03 ` pinskia at gcc dot gnu.org
2023-01-04  8:34 ` dcb314 at hotmail dot com
2023-01-04  9:08 ` dcb314 at hotmail dot com
2023-01-04  9:12 ` dcb314 at hotmail dot com
2023-01-04  9:21 ` dcb314 at hotmail dot com
2023-01-04  9:38 ` dcb314 at hotmail dot com
2023-01-04  9:39 ` fw at gcc dot gnu.org
2023-01-04 11:08 ` jakub at gcc dot gnu.org
2023-01-04 11:09 ` jakub at gcc dot gnu.org
2023-01-04 16:11 ` jakub at gcc dot gnu.org
2023-01-04 16:14 ` dcb314 at hotmail dot com
2023-01-04 16:16 ` dcb314 at hotmail dot com
2023-01-05  8:46 ` dcb314 at hotmail dot com
2023-01-09 17:24 ` rguenth at gcc dot gnu.org
2023-01-09 17:26 ` dcb314 at hotmail dot com
2023-01-09 18:03 ` jakub at gcc dot gnu.org
2023-04-26  6:57 ` [Bug middle-end/108278] [13/14 " rguenth at gcc dot gnu.org
2023-07-27  9:25 ` rguenth at gcc dot gnu.org
2024-03-22 14:01 ` law at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108278-4-gn71sGm94r@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).