diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-09 03:58:00 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-05-09 03:58:00 +0000 |
commit | bcb3170cd7700c03e5017c0a2b4e845b5cb1d763 (patch) | |
tree | 09467b7a6778576ce54cf16a985769ff3c2dacb8 /gcc/cp/call.c | |
parent | 7821c8c80c254f0dfd2a39f089d5bb1aa1bbed06 (diff) | |
download | ppe42-gcc-bcb3170cd7700c03e5017c0a2b4e845b5cb1d763.tar.gz ppe42-gcc-bcb3170cd7700c03e5017c0a2b4e845b5cb1d763.zip |
Core 624/N2932: Throw bad_array_new_length on overflow
in array new size calculation.
libstdc++-v3/
* libsupc++/new: Add std::bad_array_new_length.
* libsupc++/bad_array_new.cc: New.
* libsupc++/eh_aux_runtime.cc: Add __cxa_throw_bad_array_new_length.
* libsupc++/Makefile.in: Build them.
* config/abi/pre/gnu.ver: Add new symbols.
* config/abi/pre/gnu-versioned-namespace.ver: Add new symbols.
gcc/cp/
* init.c (throw_bad_array_new_length): New.
(build_new_1): Use it. Don't warn about braced-init-list.
(build_vec_init): Use it.
* call.c (build_operator_new_call): Use it.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@198731 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 88bf1006c7b..bd8f531eea4 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -3951,8 +3951,13 @@ build_operator_new_call (tree fnname, vec<tree, va_gc> **args, *fn = NULL_TREE; /* Set to (size_t)-1 if the size check fails. */ if (size_check != NULL_TREE) - *size = fold_build3 (COND_EXPR, sizetype, size_check, - original_size, TYPE_MAX_VALUE (sizetype)); + { + tree errval = TYPE_MAX_VALUE (sizetype); + if (cxx_dialect >= cxx11) + errval = throw_bad_array_new_length (); + *size = fold_build3 (COND_EXPR, sizetype, size_check, + original_size, errval); + } vec_safe_insert (*args, 0, *size); *args = resolve_args (*args, complain); if (*args == NULL) |