This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c/7948: gcc fails to fault gnu extension with -std=c99
- From: Richard Earnshaw <rearnsha at cambridge dot arm dot com>
- To: gcc-gnats at gcc dot gnu dot org
- Date: Tue, 17 Sep 2002 14:55:01 +0100
- Subject: c/7948: gcc fails to fault gnu extension with -std=c99
>Number: 7948
>Category: c
>Synopsis: gcc fails to fault gnu extension with -std=c99
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Tue Sep 17 06:56:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Richard Earnshaw
>Release: 3.3 20020917 (experimental)
>Organization:
ARM
>Environment:
System: Linux pc960.cambridge.arm.com 2.4.7-10 #1 Thu Sep 6 17:27:27 EDT 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: arm-unknown-elf
configured with: /home/rearnsha/gnusrc/egcs-cross/configure --prefix=/work/rearnsha/gnu/install --disable-checking --target=arm-elf --with-headers=/home/rearnsha/gnusrc/egcs-cross/newlib/libc/include
>Description:
ISO C99 states that a variable length array may only be used with
"ordinary identifiers" (ie not structure members). That makes the
following code invalid:
void f(int len)
{
struct {
char x[len];
} a;
/* ... */
}
However, gcc accepts this without complaint if the -std=c99 flag is
used (even if -pedantic is given).
>How-To-Repeat:
compile the above code fragment with
gcc -c -std=c99 -pedantic
Note that the fragment _is_ correctly rejected if -std=c89 is used.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: