This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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
>Originator:     Richard Earnshaw
>Release:        3.3 20020917 (experimental)
System: Linux 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
	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).

	compile the above code fragment with

		gcc -c -std=c99 -pedantic 

	Note that the fragment _is_ correctly rejected if -std=c89 is used.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]