PR c++/80227 - SFINAE and negative array size.
* decl.c (compute_array_index_type): Use build_converted_constant_expr and valid_constant_size_p. From-SVN: r258604
This commit is contained in:
parent
929a012293
commit
80fdaad1c7
@ -1,5 +1,9 @@
|
||||
2018-03-16 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/80227 - SFINAE and negative array size.
|
||||
* decl.c (compute_array_index_type): Use
|
||||
build_converted_constant_expr and valid_constant_size_p.
|
||||
|
||||
PR c++/84906 - silent wrong code with ambiguous conversion.
|
||||
* call.c (build_user_type_conversion_1): Set need_temporary_p on
|
||||
ambiguous conversion.
|
||||
|
@ -9514,8 +9514,6 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
|
||||
|
||||
if (!type_dependent_expression_p (size))
|
||||
{
|
||||
tree type = TREE_TYPE (size);
|
||||
|
||||
size = mark_rvalue_use (size);
|
||||
|
||||
if (cxx_dialect < cxx11 && TREE_CODE (size) == NOP_EXPR
|
||||
@ -9525,29 +9523,8 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
|
||||
else
|
||||
{
|
||||
size = instantiate_non_dependent_expr_sfinae (size, complain);
|
||||
|
||||
if (CLASS_TYPE_P (type)
|
||||
&& CLASSTYPE_LITERAL_P (type))
|
||||
{
|
||||
size = build_expr_type_conversion (WANT_INT, size, true);
|
||||
if (!size)
|
||||
{
|
||||
if (!(complain & tf_error))
|
||||
return error_mark_node;
|
||||
if (name)
|
||||
error ("size of array %qD has non-integral type %qT",
|
||||
name, type);
|
||||
else
|
||||
error ("size of array has non-integral type %qT", type);
|
||||
size = integer_one_node;
|
||||
}
|
||||
if (size == error_mark_node)
|
||||
return error_mark_node;
|
||||
type = TREE_TYPE (size);
|
||||
}
|
||||
|
||||
if (INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
|
||||
size = maybe_constant_value (size);
|
||||
size = build_converted_constant_expr (size_type_node, size, complain);
|
||||
size = maybe_constant_value (size);
|
||||
|
||||
if (!TREE_CONSTANT (size))
|
||||
size = osize;
|
||||
@ -9557,6 +9534,7 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
|
||||
return error_mark_node;
|
||||
|
||||
/* The array bound must be an integer type. */
|
||||
tree type = TREE_TYPE (size);
|
||||
if (!INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (type))
|
||||
{
|
||||
if (!(complain & tf_error))
|
||||
@ -9566,7 +9544,6 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
|
||||
else
|
||||
error ("size of array has non-integral type %qT", type);
|
||||
size = integer_one_node;
|
||||
type = TREE_TYPE (size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9604,15 +9581,12 @@ compute_array_index_type (tree name, tree size, tsubst_flags_t complain)
|
||||
/* Normally, the array-bound will be a constant. */
|
||||
if (TREE_CODE (size) == INTEGER_CST)
|
||||
{
|
||||
/* Check to see if the array bound overflowed. Make that an
|
||||
error, no matter how generous we're being. */
|
||||
constant_expression_error (size);
|
||||
|
||||
/* An array must have a positive number of elements. */
|
||||
if (tree_int_cst_lt (size, integer_zero_node))
|
||||
if (!valid_constant_size_p (size))
|
||||
{
|
||||
if (!(complain & tf_error))
|
||||
return error_mark_node;
|
||||
|
||||
if (name)
|
||||
error ("size of array %qD is negative", name);
|
||||
else
|
||||
|
10
gcc/testsuite/g++.dg/cpp0x/fntmpdefarg8.C
Normal file
10
gcc/testsuite/g++.dg/cpp0x/fntmpdefarg8.C
Normal file
@ -0,0 +1,10 @@
|
||||
// PR c++/80227
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
template <class T>
|
||||
int foo (T);
|
||||
|
||||
template <class T, class U = T [sizeof (T) - 5]>
|
||||
int foo (T, U* = 0);
|
||||
|
||||
int i = foo (123);
|
@ -5,7 +5,7 @@
|
||||
void
|
||||
foo (float n)
|
||||
{
|
||||
int A[n][n]; // { dg-error "has non-integral type" }
|
||||
int A[n][n]; // { dg-error "has non-integral type|converted constant expression" }
|
||||
#pragma omp parallel private(A)
|
||||
;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ template <typename T>
|
||||
void *
|
||||
callnew_fail_3()
|
||||
{
|
||||
return new T[2][T::n]; // { dg-error "size of array has non-integral type" }
|
||||
return new T[2][T::n]; // { dg-error "size of array has non-integral type|converted constant expression" }
|
||||
}
|
||||
|
||||
struct T1 {
|
||||
|
@ -87,10 +87,10 @@ test_one_dim_short_array ()
|
||||
static void __attribute__ ((used))
|
||||
test_two_dim_char_array ()
|
||||
{
|
||||
p = new char [1][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][MAX - 99]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][MAX - 99]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][MAX / 2]; // { dg-error "size of array" }
|
||||
p = new char [1][MAX / 2 - 1]; // { dg-error "size of array" }
|
||||
p = new char [1][MAX / 2 - 2]; // { dg-error "size of array" }
|
||||
@ -104,18 +104,18 @@ test_two_dim_char_array ()
|
||||
p = new char [1][MAX / 2 - 7]; // okay
|
||||
p = new char [1][MAX / 2 - 8]; // okay
|
||||
|
||||
p = new char [2][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX / 2]; // { dg-error "size of array" }
|
||||
p = new char [2][MAX / 2 - 1]; // { dg-error "size of array" }
|
||||
p = new char [2][MAX / 2 - 2]; // { dg-error "size of array" }
|
||||
p = new char [2][MAX / 2 - 7]; // { dg-error "size of array" }
|
||||
p = new char [2][MAX / 2 - 8]; // { dg-error "size of array" }
|
||||
|
||||
p = new char [MAX][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new char [MAX][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new char [MAX][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [MAX][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [MAX][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [MAX][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [MAX][MAX / 2]; // { dg-error "size of array" }
|
||||
p = new char [MAX][MAX / 2 - 1]; // { dg-error "size of array" }
|
||||
p = new char [MAX][MAX / 2 - 2]; // { dg-error "size of array" }
|
||||
@ -142,10 +142,10 @@ test_two_dim_char_array ()
|
||||
static __attribute__ ((used)) void
|
||||
test_three_dim_char_array ()
|
||||
{
|
||||
p = new char [1][1][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][1][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][1][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][1][MAX - 99]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][1][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][1][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][1][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][1][MAX - 99]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][1][MAX / 2]; // { dg-error "size of array" }
|
||||
p = new char [1][1][MAX / 2 - 1]; // { dg-error "size of array" }
|
||||
p = new char [1][1][MAX / 2 - 2]; // { dg-error "size of array" }
|
||||
@ -159,19 +159,19 @@ test_three_dim_char_array ()
|
||||
p = new char [1][1][MAX / 2 - 7]; // okay
|
||||
p = new char [1][1][MAX / 2 - 8]; // okay
|
||||
|
||||
p = new char [1][2][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX - 99]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX / 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX / 2 - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX / 2 - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX / 2 - 3]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX / 2 - 4]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX / 2 - 5]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX / 2 - 6]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX / 2 - 7]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX / 2 - 8]; // { dg-error "size of unnamed array" }
|
||||
p = new char [1][2][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX - 99]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX / 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX / 2 - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX / 2 - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX / 2 - 3]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX / 2 - 4]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX / 2 - 5]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX / 2 - 6]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX / 2 - 7]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX / 2 - 8]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [1][2][MAX / 4]; // { dg-error "size of array" }
|
||||
|
||||
// Avoid exercising data model-dependent expressions.
|
||||
@ -181,10 +181,10 @@ test_three_dim_char_array ()
|
||||
p = new char [1][2][MAX / 4 - 3]; // okay
|
||||
p = new char [1][2][MAX / 4 - 4]; // okay
|
||||
|
||||
p = new char [2][1][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][1][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][1][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][1][MAX - 99]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][1][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][1][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][1][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][1][MAX - 99]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][1][MAX / 2]; // { dg-error "size of array" }
|
||||
p = new char [2][1][MAX / 2 - 1]; // { dg-error "size of array" }
|
||||
p = new char [2][1][MAX / 2 - 2]; // { dg-error "size of array" }
|
||||
@ -203,19 +203,19 @@ test_three_dim_char_array ()
|
||||
p = new char [2][1][MAX / 4 - 3]; // okay
|
||||
p = new char [2][1][MAX / 4 - 4]; // okay
|
||||
|
||||
p = new char [2][2][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX - 99]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX / 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX / 2 - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX / 2 - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX / 2 - 3]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX / 2 - 4]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX / 2 - 5]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX / 2 - 6]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX / 2 - 7]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX / 2 - 8]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][2][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX - 99]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX / 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX / 2 - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX / 2 - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX / 2 - 3]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX / 2 - 4]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX / 2 - 5]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX / 2 - 6]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX / 2 - 7]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX / 2 - 8]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][2][MAX / 4]; // { dg-error "size of array" }
|
||||
p = new char [2][2][MAX / 4 - 1]; // { dg-error "size of array" }
|
||||
p = new char [2][2][MAX / 4 - 2]; // { dg-error "size of array" }
|
||||
@ -227,19 +227,19 @@ test_three_dim_char_array ()
|
||||
p = new char [2][2][MAX / 8 - 2];
|
||||
p = new char [2][2][MAX / 8 - 3];
|
||||
|
||||
p = new char [2][MAX][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX - 1][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX - 2][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX - 99][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX / 2][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX / 2 - 1][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX / 2 - 2][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX / 2 - 3][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX / 2 - 4][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX / 2 - 5][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX / 2 - 6][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX / 2 - 7][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX / 2 - 8][2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [2][MAX][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX - 1][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX - 2][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX - 99][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX / 2][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX / 2 - 1][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX / 2 - 2][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX / 2 - 3][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX / 2 - 4][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX / 2 - 5][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX / 2 - 6][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX / 2 - 7][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX / 2 - 8][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [2][MAX / 4][2]; // { dg-error "size of array" }
|
||||
p = new char [2][MAX / 4 - 1][2]; // { dg-error "size of array" }
|
||||
p = new char [2][MAX / 4 - 2][2]; // { dg-error "size of array" }
|
||||
@ -275,11 +275,11 @@ test_three_dim_char_array ()
|
||||
p = new char [MAX / 8 - 2][2][2];
|
||||
p = new char [MAX / 8 - 3][2][2];
|
||||
|
||||
p = new char [MAX][MAX][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new char [MAX][MAX][MAX / 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [MAX][MAX / 2][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new char [MAX][MAX / 2][MAX / 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [MAX / 2][MAX / 2][MAX / 2]; // { dg-error "size of unnamed array" }
|
||||
p = new char [MAX][MAX][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [MAX][MAX][MAX / 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [MAX][MAX / 2][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [MAX][MAX / 2][MAX / 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new char [MAX / 2][MAX / 2][MAX / 2]; // { dg-error "size of (unnamed )?array" }
|
||||
}
|
||||
|
||||
// Exercise new expression with N-dimensional arrays where N is
|
||||
@ -342,10 +342,10 @@ test_one_dim_byte_array (void *p)
|
||||
static void __attribute__ ((used))
|
||||
test_placement_two_dim_byte_struct_array (void *p)
|
||||
{
|
||||
p = new (p) B [1][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][MAX - 99]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][MAX - 99]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][MAX / 2]; // { dg-error "size of array" }
|
||||
p = new (p) B [1][MAX / 2 - 1]; // { dg-error "size of array" }
|
||||
p = new (p) B [1][MAX / 2 - 2]; // { dg-error "size of array" }
|
||||
@ -359,18 +359,18 @@ test_placement_two_dim_byte_struct_array (void *p)
|
||||
p = new (p) B [1][MAX / 2 - 7]; // okay
|
||||
p = new (p) B [1][MAX / 2 - 8]; // okay
|
||||
|
||||
p = new (p) B [2][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX / 2]; // { dg-error "size of array" }
|
||||
p = new (p) B [2][MAX / 2 - 1]; // { dg-error "size of array" }
|
||||
p = new (p) B [2][MAX / 2 - 2]; // { dg-error "size of array" }
|
||||
p = new (p) B [2][MAX / 2 - 7]; // { dg-error "size of array" }
|
||||
p = new (p) B [2][MAX / 2 - 8]; // { dg-error "size of array" }
|
||||
|
||||
p = new (p) B [MAX][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [MAX][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [MAX][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [MAX][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [MAX][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [MAX][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [MAX][MAX / 2]; // { dg-error "size of array" }
|
||||
p = new (p) B [MAX][MAX / 2 - 1]; // { dg-error "size of array" }
|
||||
p = new (p) B [MAX][MAX / 2 - 2]; // { dg-error "size of array" }
|
||||
@ -397,10 +397,10 @@ test_placement_two_dim_byte_struct_array (void *p)
|
||||
static __attribute__ ((used)) void
|
||||
test_placement_three_dim_byte_struct_array (void *p)
|
||||
{
|
||||
p = new (p) B [1][1][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][1][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][1][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][1][MAX - 99]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][1][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][1][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][1][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][1][MAX - 99]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][1][MAX / 2]; // { dg-error "size of array" }
|
||||
p = new (p) B [1][1][MAX / 2 - 1]; // { dg-error "size of array" }
|
||||
p = new (p) B [1][1][MAX / 2 - 2]; // { dg-error "size of array" }
|
||||
@ -414,19 +414,19 @@ test_placement_three_dim_byte_struct_array (void *p)
|
||||
p = new (p) B [1][1][MAX / 2 - 7]; // okay
|
||||
p = new (p) B [1][1][MAX / 2 - 8]; // okay
|
||||
|
||||
p = new (p) B [1][2][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX - 99]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX / 2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 3]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 4]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 5]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 6]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 7]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 8]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [1][2][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX - 99]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX / 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 3]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 4]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 5]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 6]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 7]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX / 2 - 8]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [1][2][MAX / 4]; // { dg-error "size of array" }
|
||||
|
||||
// Avoid exercising data model-dependent expressions.
|
||||
@ -436,10 +436,10 @@ test_placement_three_dim_byte_struct_array (void *p)
|
||||
p = new (p) B [1][2][MAX / 4 - 3]; // okay
|
||||
p = new (p) B [1][2][MAX / 4 - 4]; // okay
|
||||
|
||||
p = new (p) B [2][1][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][1][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][1][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][1][MAX - 99]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][1][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][1][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][1][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][1][MAX - 99]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][1][MAX / 2]; // { dg-error "size of array" }
|
||||
p = new (p) B [2][1][MAX / 2 - 1]; // { dg-error "size of array" }
|
||||
p = new (p) B [2][1][MAX / 2 - 2]; // { dg-error "size of array" }
|
||||
@ -458,19 +458,19 @@ test_placement_three_dim_byte_struct_array (void *p)
|
||||
p = new (p) B [2][1][MAX / 4 - 3]; // okay
|
||||
p = new (p) B [2][1][MAX / 4 - 4]; // okay
|
||||
|
||||
p = new (p) B [2][2][MAX]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX - 99]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX / 2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 1]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 3]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 4]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 5]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 6]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 7]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 8]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][2][MAX]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX - 99]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX / 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 1]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 3]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 4]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 5]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 6]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 7]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX / 2 - 8]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][2][MAX / 4]; // { dg-error "size of array" }
|
||||
p = new (p) B [2][2][MAX / 4 - 1]; // { dg-error "size of array" }
|
||||
p = new (p) B [2][2][MAX / 4 - 2]; // { dg-error "size of array" }
|
||||
@ -482,19 +482,19 @@ test_placement_three_dim_byte_struct_array (void *p)
|
||||
p = new (p) B [2][2][MAX / 8 - 2];
|
||||
p = new (p) B [2][2][MAX / 8 - 3];
|
||||
|
||||
p = new (p) B [2][MAX][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX - 1][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX - 2][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX - 99][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX / 2][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX / 2 - 1][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX / 2 - 2][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX / 2 - 3][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX / 2 - 4][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX / 2 - 5][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX / 2 - 6][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX / 2 - 7][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX / 2 - 8][2]; // { dg-error "size of unnamed array" }
|
||||
p = new (p) B [2][MAX][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX - 1][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX - 2][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX - 99][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX / 2][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX / 2 - 1][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX / 2 - 2][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX / 2 - 3][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX / 2 - 4][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX / 2 - 5][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX / 2 - 6][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX / 2 - 7][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX / 2 - 8][2]; // { dg-error "size of (unnamed )?array" }
|
||||
p = new (p) B [2][MAX / 4][2]; // { dg-error "size of array" }
|
||||
p = new (p) B [2][MAX / 4 - 1][2]; // { dg-error "size of array" }
|
||||
p = new (p) B [2][MAX / 4 - 2][2]; // { dg-error "size of array" }
|
||||
|
@ -2,5 +2,4 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-fsanitize=undefined" } */
|
||||
|
||||
int a[(long) 4e20]; /* { dg-error "overflow in constant expression" } */
|
||||
/* { dg-error "size of array .a. is too large" "" { target *-*-* } .-1 } */
|
||||
int a[(long) 4e20]; /* { dg-error "size of array .a. is (too large|negative)" } */
|
||||
|
Loading…
x
Reference in New Issue
Block a user