[Bug c/50584] No warning for passing small array to C99 static array declarator

2013-08-13 Thread me at minglis dot id.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50584

Malcolm Inglis  changed:

   What|Removed |Added

 CC||me at minglis dot id.au

--- Comment #2 from Malcolm Inglis  ---
GCC 4.8.1 is still failing to warn for static array indices in function
parameters.

The C99 status pages say this feature has been done since 3.1:
http://gcc.gnu.org/gcc-3.1/c99status.html

Was there a regression?


[Bug c/50584] No warning for passing small array to C99 static array declarator

2013-09-25 Thread me at minglis dot id.au
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50584

--- Comment #4 from Malcolm Inglis  ---
I don't have a copy of the C99 standard, but IBM says [1] that if the function
is called with a pointer to a smaller array than specified with `static`, then
the behavior is undefined. Ergo, there should be a warning.

Could someone change the status of this bug?

I'm about 60% sure that I once played around with this in GCC, and it correctly
reported an error. This wouldn't have been too long ago; maybe 4.6 or even 4.7.

Clang emits a warning for this. [2]

I think this is a fantastic language feature. It's a shame GCC doesn't support
it yet.

[1]:
http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/topic/com.ibm.xlcpp8a.doc/language/ref/param_decl.htm

[2]: http://hamberg.no/erlend/posts/2013-02-18-static-array-indices.html