From mboxrd@z Thu Jan 1 00:00:00 1970 From: Toshi Morita To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org Subject: Re: c/2591: variable expression erroneously allowed to dimension array Date: Thu, 19 Apr 2001 16:06:00 -0000 Message-id: <20010419230601.5623.qmail@sourceware.cygnus.com> X-SW-Source: 2001-04/msg00347.html List-Id: The following reply was made to PR c/2591; it has been noted by GNATS. From: Toshi Morita To: allen.everhart@marcgs.com Cc: gcc-gnats@gcc.gnu.org Subject: Re: c/2591: variable expression erroneously allowed to dimension array Date: Thu, 19 Apr 2001 15:58:21 -0700 (PDT) > > >Number: 2591 > >Category: c > >Synopsis: variable expression erroneously allowed to dimension array > >Confidential: no > >Severity: serious > >Priority: high > >Responsible: unassigned > >State: open > >Class: accepts-illegal > >Submitter-Id: net > >Arrival-Date: Thu Apr 19 14:26:00 PDT 2001 > >Closed-Date: > >Last-Modified: > >Originator: Allen Everhart > >Release: gcc version 2.8.1 ... > int printf( char *, ... ) ; > int i=1 ; > > int main() > { > char buff[i] ; /* variable expression allowed to dimension array */ > > buff[0] = 'f' ; > buff[1] = 'o' ; > buff[2] = 'o' ; > buff[3] = '\0' ; > return printf( "%s %d\n", buff, sizeof(buff) ) ; > } This is a GNU C extension. If you want to disable GNU C extensions, you should use -pedantic -ansi, I believe. Toshi