public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/66145] New: std::ios_base::failure objects thrown from libstdc++.so use old ABI
Date: Thu, 14 May 2015 16:59:00 -0000	[thread overview]
Message-ID: <bug-66145-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 66145
           Summary: std::ios_base::failure objects thrown from
                    libstdc++.so use old ABI
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Keywords: ABI
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: doko at gcc dot gnu.org
  Target Milestone: ---

Using the new cxx11 ABI in GCC5 (and trunk) the exception here isn't caught:

#define _GLIBCXX_USE_CXX11_ABI 1
#include <fstream>
#include <limits>

int main()
{
  std::fstream f;
  f.exceptions(std::ios::badbit);
  try {
    f.pword(std::numeric_limits<int>::max());
  } catch (const std::ios_base::failure&) {
    return 0;
  }
  throw 1;
}


terminate called after throwing an instance of 'std::ios_base::failure'
  what():  ios_base::_M_grow_words is not valid
Aborted (core dumped)

This is because src/c++11/functexcept.cc has:

// We don't want to change the type thrown by __throw_ios_failure (yet?)
#define _GLIBCXX_USE_CXX11_ABI 0

I actually planned to change it for GCC5 but missed it. If we change the ABI
used to compile functexcept.cc then the code above would fail when using the
old ABI instead.

One option to make both forms work would be to hack the EH runtime to make
handlers for std::ios_base::failure able to catch
std::ios_base::failure[abi:cxx11] objects, and vice versa, creating an object
of the other type on the fly.


             reply	other threads:[~2015-05-14 16:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 16:59 redi at gcc dot gnu.org [this message]
2015-05-20 16:58 ` [Bug libstdc++/66145] [5/6 Regression] " redi at gcc dot gnu.org
2015-06-01 12:02 ` hjl.tools at gmail dot com
2015-07-23 11:11 ` rguenth at gcc dot gnu.org
2015-10-06 21:52 ` redi at gcc dot gnu.org
2015-10-06 23:02 ` redi 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-66145-4@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).