[Bug c/85361] New: Variable length array allowed in c89/90
whh8b at virginia dot edu
gcc-bugzilla@gcc.gnu.org
Wed Apr 11 23:45:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85361
Bug ID: 85361
Summary: Variable length array allowed in c89/90
Product: gcc
Version: 5.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: whh8b at virginia dot edu
Target Milestone: ---
Created attachment 43914
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43914&action=edit
Code to trigger behavior.
In an attempt to fix bug 44209, I was investigating warning messages about
variable length arrays.
The c89/90 standard appears to forbid VLAs but GCC treats their presence as
something only to warn the user about. Should this be an error instead of a
warning?
Depending on how you invoke GCC on the code attached to this report, it either
compiles with no complaints:
$ gcc -std=c89 /tmp/vla.c
$
or with a simple warning:
$ gcc -std=c89 -Wpedantic /tmp/vla.c
/tmp/vla.c:1:13: warning: ISO C90 does not support ‘[*]’ array declarators
[-Wpedantic]
void f(int a[*]);
$
Since gcc gives the user the option to specify which version of the c standard
to adhere to, shouldn't gcc be a little more strict when the user is explicit?
I absolutely appeal to the wiser counsel of all the experts, but I thought I
would ask.
Thank you!
More information about the Gcc-bugs
mailing list