Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1517473 - A C++ exception of type 'std::ios_base::failure' is being thrown which is not handled by the exception handler
Summary: A C++ exception of type 'std::ios_base::failure' is being thrown which is not...
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 25
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-25 20:15 UTC by Luc Bougé
Modified: 2017-12-21 18:38 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-12-12 10:03:34 UTC


Attachments (Terms of Use)
Test program (deleted)
2017-11-25 20:15 UTC, Luc Bougé
no flags Details

Description Luc Bougé 2017-11-25 20:15:09 UTC
Created attachment 1359024 [details]
Test program

Description of problem:


Version-Release number of selected component (if applicable):
gcc version 6.4.1 20170727 (Red Hat 6.4.1-1) (GCC) 

How reproducible:
Compile and run the attached program

Steps to Reproduce

1. Compile: g++ test.cc -o test
2. Run: ./test

Actual results:

   Caught an unknown exception

Expected results:

   Caught an ios_base::failure

Additional info:

According to the C++ documentation <http://en.cppreference.com/w/cpp/io/ios_base/failure>, the program should write "Caught an ios_base::failure". 

When compiled with g++ (and also clang++), it instead writes  "Caught an unknown exception". 

Searching the Web for the explanation, I found the following page <https://access.redhat.com/solutions/973223>, dated June 2014, titled: 

   A C++ exception of type 'std::ios_base::failure' is being thrown 
   which is not handled by the exception handler

It exactly describes the observed problem. It explains it is due to a bugged version of the libgcc library.

   This package "libgcc-4.1-32bit-4.1.2_20070115-0.2.x86_64" has provided 
   its own /lib/libgcc.so.1 file, a non standard (third party) /lib/libgcc.so.1
   supplied by a third party. This can override (and change) behaviour in the
   libstdc++ libraries exception handling abilities.

Here is my current /lib/libgcc file.

$ ll /lib/libgcc*
-rwxr-xr-x 1 root root 116520 Jul 27 13:34 /lib/libgcc_s-6.4.1-20170727.so.1
lrwxrwxrwx 1 root root     28 Jul 27 13:30 /lib/libgcc_s.so.1 -> libgcc_s-6.4.1-20170727.so.1

Comment 1 Jonathan Wakely 2017-11-27 11:31:12 UTC
This is expected behaviour, due to the dual abi:
https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html

GCC 6 throws the old ios::failure type from the library, so the catch either needs to catch std::exception& instead, or the code containing the catch needs to be compiled using the old ABI, i.e. _GLIBCXX_USE_CXX11_ABI=0

Comment 2 Jonathan Wakely 2017-11-27 11:32:34 UTC
(It has nothing to do with libgcc)

Comment 3 Fedora End Of Life 2017-12-12 10:03:34 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 4 Luc Bougé 2017-12-21 18:38:02 UTC
Thanks to Jonathan for his pointer. It perfectly explains the behavior observed by my students. And it teaches something new to their teacher! Best regards, Luc.


Note You need to log in before you can comment on or make changes to this bug.