+2013-11-23 Alexander Ivchenko <alexander.ivchenko@intel.com>
+
+ PR c++/58525
+ * call.c (build_operator_new_call): Add flag_exceptions check.
+ * decl.c (compute_array_index_type): Ditto.
+ * init.c (build_new_1): Ditto.
+ (build_vec_init): Ditto.
+
2013-11-22 Jakub Jelinek <jakub@redhat.com>
* cp-gimplify.c: Include target.h and c-family/c-ubsan.h.
if (size_check != NULL_TREE)
{
tree errval = TYPE_MAX_VALUE (sizetype);
- if (cxx_dialect >= cxx11)
+ if (cxx_dialect >= cxx11 && flag_exceptions)
errval = throw_bad_array_new_length ();
*size = fold_build3 (COND_EXPR, sizetype, size_check,
original_size, errval);
stabilize_vla_size (itype);
- if (cxx_dialect >= cxx1y)
+ if (cxx_dialect >= cxx1y && flag_exceptions)
{
/* If the VLA bound is larger than half the address space,
or less than zero, throw std::bad_array_length. */
}
/* Perform the overflow check. */
tree errval = TYPE_MAX_VALUE (sizetype);
- if (cxx_dialect >= cxx11)
+ if (cxx_dialect >= cxx11 && flag_exceptions)
errval = throw_bad_array_new_length ();
if (outer_nelts_check != NULL_TREE)
size = fold_build3 (COND_EXPR, sizetype, outer_nelts_check,
is big enough for all the initializers. */
if (init && TREE_CODE (init) == CONSTRUCTOR
&& CONSTRUCTOR_NELTS (init) > 0
- && !TREE_CONSTANT (maxindex))
+ && !TREE_CONSTANT (maxindex)
+ && flag_exceptions)
length_check = fold_build2 (LT_EXPR, boolean_type_node, maxindex,
size_int (CONSTRUCTOR_NELTS (init) - 1));