+2001-12-03 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * c-typeck.c (really_start_incremental_init, push_init_level):
+ Avoid constructor_max_index being other than an INTEGER_CST.
+
2001-12-02 David Edelsohn <edelsohn@gnu.org>
* config/rs6000/xcoff.h (ASM_OUTPUT_INTERNAL_LABEL): Display count
&& TYPE_SIZE (constructor_type))
constructor_max_index = build_int_2 (-1, -1);
+ /* constructor_max_index needs to be an INTEGER_CST. Attempts
+ to initialize VLAs will cause an proper error; avoid tree
+ checking errors as well by setting a safe value. */
+ if (constructor_max_index
+ && TREE_CODE (constructor_max_index) != INTEGER_CST)
+ constructor_max_index = build_int_2 (-1, -1);
+
constructor_index
= convert (bitsizetype,
TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type)));
&& TYPE_SIZE (constructor_type))
constructor_max_index = build_int_2 (-1, -1);
+ /* constructor_max_index needs to be an INTEGER_CST. Attempts
+ to initialize VLAs will cause an proper error; avoid tree
+ checking errors as well by setting a safe value. */
+ if (constructor_max_index
+ && TREE_CODE (constructor_max_index) != INTEGER_CST)
+ constructor_max_index = build_int_2 (-1, -1);
+
constructor_index
= convert (bitsizetype,
TYPE_MIN_VALUE (TYPE_DOMAIN (constructor_type)));
+2001-12-03 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * gcc.dg/vla-init-1.c: New test.
+
2001-12-01 Geoff Keating <geoffk@redhat.com>
* gcc.c-torture/compile/structs.c: New testcase from GDB.
--- /dev/null
+/* Test for tree-checking error when initializing a variable-length array
+ (not allowed): constructor_max_index needs to be an INTEGER_CST. */
+/* Origin: Joseph Myers <jsm28@cam.ac.uk>. */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+int a;
+
+void
+foo (void)
+{
+ int x[a] = { 1 }; /* { dg-error "init" "VLA init" } */
+}