public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/66145] New: std::ios_base::failure objects thrown from libstdc++.so use old ABI
@ 2015-05-14 16:59 redi at gcc dot gnu.org
  2015-05-20 16:58 ` [Bug libstdc++/66145] [5/6 Regression] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2015-05-14 16:59 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-06 23:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-14 16:59 [Bug libstdc++/66145] New: std::ios_base::failure objects thrown from libstdc++.so use old ABI redi at gcc dot gnu.org
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

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).