c/2002: problem (?) with variable length arrays extension

itlee@slac.stanford.edu itlee@slac.stanford.edu
Thu Feb 15 13:56:00 GMT 2001


>Number:         2002
>Category:       c
>Synopsis:       problem (?) with variable length arrays extension
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 15 13:56:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Irwin Lee
>Release:        gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
>Organization:
>Environment:
Slackware Linux v7.0 on ix86
>Description:
I'm not sure if this is a bug or some kind of obscure
feature.  When using variable length arrays, adding 1
seems to be a problem, generating:

foo.c: In function `bar':
foo.c:5: size of array `baz' is too large
>How-To-Repeat:
buran$ cat foo.c 
int foo;

void bar()
{
  int baz[foo + GRR];
}
buran$ gcc -DGRR=2 foo.c 
/usr/lib/crt1.o(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
buran$ gcc -DGRR=1 foo.c 
foo.c: In function `bar':
foo.c:5: size of array `baz' is too large
>Fix:
Well, I had to put 2 instead of 1.
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list