[PATCH] Mitigate PR85222 a bit

Jonathan Wakely jwakely.gcc@gmail.com
Fri Apr 6 11:17:00 GMT 2018


On 6 April 2018 at 10:39, Richard Biener wrote:
>
> The following allows people configuring the gcc-4 compatible ABI
> as the default ABI to retain compatibility with old programs
> catching ios_base::failure by matching the abi version thrown
> to the configured default ABI.
>
> This doesn't really fix the PR but it makes behavior between
> the dual-ABI with default gcc-4 compatible consistent with that
> of the non-dual-ABI which is what I had expected.
>
> Whether an ABI break is really desired for the case of a c++11
> default ABI is still questionable and any programs that differ
> from the default ABI choice will now be broken (compared to
> those differing from c++11).
>
> Bootstrapped on x86_64-unknown-linux-gnu, ok for trunk?  Ok for
> the GCC 7 branch?

Thinking about this further, I seem to recall we decided *not* to do
this. Currently the --with-default-libstdcxx-abi flag only affects the
default value of a macro in the headers, it doesn't affect the library
ABI. The header macro can be overriden per translation unit, but the
library ABI is always the same (it always throws the new ios::failure
type). With this change the option would affect the library ABI and so
--with-default-libstdcxx-abi would cause a new effect on libstdc++.so

> I'm not sure if we want to revert r245167 after this?  I'm
> re-running the testsuite with a gcc4-compatible ABI right now.
> At least with a "real" fix we should be able to run the affected
> tests twice, once with the new and once with the old ABI.
>
> Thanks,
> Richard.
>
> 2018-04-06  Richard Biener  <rguenther@suse.de>
>
>         PR libstdc++/85222
>         * src/c++11/ios.cc: Remove hard define of _GLIBCXX_USE_CXX11_ABI to 1.
>         Instead use the configured default ABI to decide the ABI version
>         of ios_base::failure thrown by __throw_ios_failure.
>
> Index: libstdc++-v3/src/c++11/ios.cc
> ===================================================================
> --- libstdc++-v3/src/c++11/ios.cc       (revision 258812)
> +++ libstdc++-v3/src/c++11/ios.cc       (working copy)
> @@ -26,9 +26,8 @@
>  // ISO C++ 14882: 27.4  Iostreams base classes
>  //
>
> -// Determines the version of ios_base::failure thrown by __throw_ios_failure.
> -// If !_GLIBCXX_USE_DUAL_ABI this will get undefined automatically.
> -#define _GLIBCXX_USE_CXX11_ABI 1
> +// The ABI version of ios_base::failure thrown by __throw_ios_failure
> +// is determined by the default ABI version choosed at configure time
>
>  #include <ios>
>  #include <limits>



More information about the Gcc-patches mailing list