re PR c/11207 (ICE with negative index in array element designator)
PR c/11207 * c-typeck.c (set_init_index): Check for negative index. (testsuite/) * gcc.dg/noncompile/20030818-1.c: New. From-SVN: r70553
This commit is contained in:
parent
dfccfad9bb
commit
622adc7e1d
4 changed files with 14 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
2003-08-18 Matt Kraai <kraai@alumni.cmu.edu>
|
||||
|
||||
PR c/11207
|
||||
* c-typeck.c (set_init_index): Check for negative index.
|
||||
|
||||
2003-08-18 Bob Wilson <bob.wilson@acm.org>
|
||||
|
||||
* config/xtensa/crti.asm (_init, _fini): Add alternate code for new
|
||||
|
|
|
@ -4956,6 +4956,8 @@ set_init_index (tree first, tree last)
|
|||
error_init ("nonconstant array index in initializer");
|
||||
else if (TREE_CODE (constructor_type) != ARRAY_TYPE)
|
||||
error_init ("array index in non-array initializer");
|
||||
else if (tree_int_cst_sgn (first) == -1)
|
||||
error_init ("array index in initializer exceeds array bounds");
|
||||
else if (constructor_max_index
|
||||
&& tree_int_cst_lt (constructor_max_index, first))
|
||||
error_init ("array index in initializer exceeds array bounds");
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2003-08-18 Matt Kraai <kraai@alumni.cmu.edu>
|
||||
|
||||
* gcc.dg/noncompile/20030818-1.c: New.
|
||||
|
||||
2003-08-18 Nathan Sidwell <nathan@codesourcery.com>
|
||||
|
||||
* g++.dg/template/scope2.C: New test.
|
||||
|
|
3
gcc/testsuite/gcc.dg/noncompile/20030818-1.c
Normal file
3
gcc/testsuite/gcc.dg/noncompile/20030818-1.c
Normal file
|
@ -0,0 +1,3 @@
|
|||
/* PR 11207. */
|
||||
|
||||
char font8x8[256][8] = { [-1] = { 0 } }; /* { dg-error "array index in initializer exceeds array bounds" } */
|
Loading…
Add table
Reference in a new issue