diff options
author | Richard Henderson <rth@redhat.com> | 2012-11-06 09:38:38 -0800 |
---|---|---|
committer | Richard Henderson <rth@redhat.com> | 2012-11-06 09:38:38 -0800 |
commit | 5347d82b89a27d541b39439aed0d304426d8b353 (patch) | |
tree | 0274b6cb0ba20dc1921b76214bfc54e6495820e7 /libstdc++-v3/libsupc++/vec.cc | |
parent | cdbe84c78a7a5fb14e7d89200559237335f2a860 (diff) | |
parent | 698dd25b854c589f62180a0324806e8899c76bcd (diff) | |
download | gcc-5347d82b89a27d541b39439aed0d304426d8b353.tar.gz |
Merge remote-tracking branch 'trunk' into aldyh/uninst
Diffstat (limited to 'libstdc++-v3/libsupc++/vec.cc')
-rw-r--r-- | libstdc++-v3/libsupc++/vec.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libstdc++-v3/libsupc++/vec.cc b/libstdc++-v3/libsupc++/vec.cc index f9afd39df9b..507514ec76a 100644 --- a/libstdc++-v3/libsupc++/vec.cc +++ b/libstdc++-v3/libsupc++/vec.cc @@ -28,6 +28,7 @@ #include <cxxabi.h> #include <new> #include <exception> +#include <cstdlib> #include <bits/exception_defines.h> #include "unwind-cxx.h" @@ -65,10 +66,18 @@ namespace __cxxabiv1 std::size_t padding_size) { if (element_size && element_count > std::size_t(-1) / element_size) +#ifdef __EXCEPTIONS throw std::bad_alloc(); +#else + std::abort(); +#endif std::size_t size = element_count * element_size; if (size + padding_size < size) +#ifdef __EXCEPTIONS throw std::bad_alloc(); +#else + std::abort(); +#endif return size + padding_size; } } |