This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/66145] [5/6/7 Regression] std::ios_base::failure objects thrown from libstdc++.so use old ABI
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 04 Apr 2018 13:59:59 +0000
- Subject: [Bug libstdc++/66145] [5/6/7 Regression] std::ios_base::failure objects thrown from libstdc++.so use old ABI
- Auto-submitted: auto-generated
- References: <bug-66145-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66145
--- Comment #33 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #32)
> Now the reverse fails - a program compiled with a GCC defaulting to the old
> ABI
> (like GCC 4.8) now fails to run with a dual-ABI libstdc++:
>
> #include <iostream>
> #include <fstream>
> using namespace std;
> int main ()
> {
> std::ifstream pstats;
> pstats.exceptions(ifstream::failbit | ifstream::badbit | ifstream::eofbit);
> try {
> printf("\n Opening file : /proc/0/stat ");
> pstats.open("/proc/0/stat");
> }
> catch(ifstream::failure e)
> {
> printf("\n!!Caught ifstream exception!!\n");
> if(pstats.is_open()) {
> pstats.close();
> }
> }
> return 0;
> }
> tmp> g++-4.8 t.C
> tmp> ./a.out
>
> terminate called after throwing an instance of
> 'std::ios_base::failure[abi:cxx11]'
> what(): basic_ios::clear: iostream error
> Aborted (core dumped)
> tmp> LD_LIBRARY_PATH=/space/rguenther/install/gcc-6.4/lib64 ./a.out
>
> Opening file : /proc/0/stat
> !!Caught ifstream exception!!
--disable-libstdcxx-dual-abi makes the symbol (__throw_ios_failure) throw
c++98 classes again. --with-default-libstdcxx-abi=gcc4-compatible does not.
Probably impossible to fix without breaking the ABI again, but there should
have been two __throw_ios_failure entries (and callers be "versioned" as well).
At least the old symbol should have been preserved as backward compatible
and a new with a new version be added ... should have been ...