Problem using global const for array size

Mike Stump mrs@windriver.com
Thu May 4 22:17:00 GMT 2000


This bugs appears to have been fixed in the development versions, the
next release should not have this bug.

> Date: Thu, 04 May 2000 21:28:35 -0700
> From: Tron Thomas <tron.thomas@sierra.com>

> I am using egcs-2.91.66 19990314/Linux (egcs-1.1.2 release) that came
> with RedHat 6.0 (Intel)

> I compiled the following program using "gcc -d -Wall"

> const int nSIZE = 8;

> int main(void)
> {
>     char szText[nSIZE + 1];

>     exit(0);
> }

> I get the following results:
> In function 'main':
> size of array 'szText' is too large

> The size of szText array should only be 9 bytes, which should be
> considered too large.

> If I compile this code:

> int main(void)
> {
>      const int nSIZE = 8;
>     char szText[nSIZE + 1];

>     exit(0);
> }

> It compiles without error.


More information about the Gcc-bugs mailing list