This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR 11207


On Sun, Aug 24, 2003 at 08:46:12PM -0400, David Edelsohn wrote:
>         PR c/11207
>         * c-typeck.c (set_init_index): Check for negative index.
> 
> The testcase associated with this patch is producing failures due to
> additional error messages:
> 
> char font8x8[256][8] = { [-1] = { 0 } }; /* { dg-error "array index in initializer exceeds array bounds" } */
> 
> src/gcc/testsuite/gcc.dg/noncompile/20030818-1.c:3: error: array index in initializer exceeds array bounds
> src/gcc/testsuite/gcc.dg/noncompile/20030818-1.c:3: error: (near initialization for `font8x8')
> 
> PASS: gcc.dg/noncompile/20030818-1.c  (test for errors, line 3)
> FAIL: gcc.dg/noncompile/20030818-1.c (test for excess errors)
> Excess errors:
> /src/gcc/testsuite/gcc.dg/noncompile/20030818-1.c:3: error: (near initialization for `font8x8')

The following patch fixes it:

	* gcc.dg/noncompile/20030818-1.c: Expect second line of	error.

Index: gcc/testsuite/gcc.dg/noncompile/20030818-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/noncompile/20030818-1.c,v
retrieving revision 1.1
diff -3 -c -p -r1.1 20030818-1.c
*** gcc/testsuite/gcc.dg/noncompile/20030818-1.c	19 Aug 2003 01:36:29 -0000	1.1
--- gcc/testsuite/gcc.dg/noncompile/20030818-1.c	25 Aug 2003 04:34:53 -0000
***************
*** 1,3 ****
  /* PR 11207.  */
  
! char font8x8[256][8] = { [-1] = { 0 } }; /* { dg-error "array index in initializer exceeds array bounds" } */
--- 1,3 ----
  /* PR 11207.  */
  
! char font8x8[256][8] = { [-1] = { 0 } }; /* { dg-error "array index|near init" } */

Bootstrapped and regression tested on powerpc-unknown-linux-gnu.

OK to commit?  To the 3.3 branch?

-- 
Matt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]