diff options
author | Jason Merrill <jason@redhat.com> | 2013-05-08 23:58:00 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2013-05-08 23:58:00 -0400 |
commit | 7d5e76c8de1b6c4b2ae5576ab909dc9e580b216b (patch) | |
tree | 09467b7a6778576ce54cf16a985769ff3c2dacb8 /gcc/cp/call.c | |
parent | b0f36e5ee07dd1fa2d8345bcb1751aab3e95f980 (diff) | |
download | gcc-7d5e76c8de1b6c4b2ae5576ab909dc9e580b216b.zip gcc-7d5e76c8de1b6c4b2ae5576ab909dc9e580b216b.tar.gz gcc-7d5e76c8de1b6c4b2ae5576ab909dc9e580b216b.tar.bz2 |
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.
From-SVN: r198731
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 88bf100..bd8f531 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) |