[cfe-dev] Fixed-size argument arrays in LLVM assembly

David Tweed david.tweed at arm.com
Thu Feb 14 00:59:08 PST 2013


Hi,

> While C (and other languages that share this approach) does not impose any
bounds checking, maintaining the sizes may be meaningful for certain
targets, e.g. non-programmable hardware.

| There is no C-level language requirement at all that the argument actually
be an array of that size or greater.

I'm not a language lawyer, but just as a trifling technicality I gather the
construct

void f(int m,int array[static m])

then "the value of the corresponding actual argument shall provide access to
the first element of an array with at least as many elements as specified by
the size expression". So you might get user code using this construct whence
the compiler is entitled to expect a minimum size. But that's realy quite a
weak requirement, and it's also the wrong way round ("at least as big as"
rather than "not bigger than").

Cheers,
Dave







More information about the cfe-dev mailing list