c/4698: constant beginning with 0 as array index

bonnaud@iut2.upmf-grenoble.fr bonnaud@iut2.upmf-grenoble.fr
Fri Oct 26 07:46:00 GMT 2001


>Number:         4698
>Category:       c
>Synopsis:       constant beginning with 0 as array index does not compile
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 26 07:46:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.0.2 (Debian) (Debian testing/unstable)
>Organization:
>Environment:
System: Linux pc-dg-116-1 2.4.12-686 #2 Sat Oct 13 20:13:05 EST 2001 i686 unknown
Architecture: i686

host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:

The following program does not compile:

int main(void)
{
  int tab[011];

  tab[09]=1;      /* error here only */
  tab[10]=02;
}

Is it a legal program or is there some subtle C/C++ rule that say it
is not ?

>How-To-Repeat:

$ gcc essai.c
essai.c: In function `main':
essai.c:5: numeric constant contains digits beyond the radix

The same error happens both with gcc and g++.  I tested versions
2.95.x and 3.0.x.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list