Commit fd857de8 by Christophe Lyon

c: ignore initializers for elements of variable-size types [PR93577]

2020-03-17  Christophe Lyon  <christophe.lyon@linaro.org>

	gcc/
	* c-typeck.c (process_init_element): Handle constructor_type with
	type size represented by POLY_INT_CST.

	gcc/testsuite/
	* gcc.target/aarch64/sve/acle/general-c/sizeless-1.c: Remove
	superfluous dg-error.
	* gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Likewise.
parent 741ff2a2
2020-03-17 Christophe Lyon <christophe.lyon@linaro.org>
* c-typeck.c (process_init_element): Handle constructor_type with
type size represented by POLY_INT_CST.
2020-03-17 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/94187
......
......@@ -9968,7 +9968,7 @@ process_init_element (location_t loc, struct c_expr value, bool implicit,
/* Ignore elements of an initializer for a variable-size type.
Those are diagnosed in digest_init. */
if (COMPLETE_TYPE_P (constructor_type)
&& TREE_CODE (TYPE_SIZE (constructor_type)) != INTEGER_CST)
&& !poly_int_tree_p (TYPE_SIZE (constructor_type)))
return;
if (!implicit && warn_designated_init && !was_designated
......
2020-03-17 Christophe Lyon <christophe.lyon@linaro.org>
* gcc.target/aarch64/sve/acle/general-c/sizeless-1.c: Remove
superfluous dg-error.
* gcc.target/aarch64/sve/acle/general-c/sizeless-2.c: Likewise.
2020-03-17 Jakub Jelinek <jakub@redhat.com>
PR middle-end/94189
......
......@@ -83,7 +83,6 @@ statements (int n)
svint8_t array[2]; /* { dg-error {array elements cannot have SVE type 'svint8_t'} } */
svint8_t zero_length_array[0]; /* { dg-error {array elements cannot have SVE type 'svint8_t'} } */
svint8_t empty_init_array[] = {}; /* { dg-error {array elements cannot have SVE type 'svint8_t'} } */
/* { dg-error {empty scalar initializer} "" { target *-*-* } .-1 } */
typedef svint8_t vla_type[n]; /* { dg-error {array elements cannot have SVE type 'svint8_t'} } */
/* Assignment. */
......
......@@ -83,7 +83,6 @@ statements (int n)
svint8_t array[2]; /* { dg-error {array elements cannot have SVE type 'svint8_t'} } */
svint8_t zero_length_array[0]; /* { dg-error {array elements cannot have SVE type 'svint8_t'} } */
svint8_t empty_init_array[] = {}; /* { dg-error {array elements cannot have SVE type 'svint8_t'} } */
/* { dg-error {empty scalar initializer} "" { target *-*-* } .-1 } */
typedef svint8_t vla_type[n]; /* { dg-error {array elements cannot have SVE type 'svint8_t'} } */
/* Assignment. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment