[cfe-dev] Fixed-size argument arrays in LLVM assembly
david.tweed at arm.com
Thu Feb 14 03:44:50 PST 2013
| David, your approach offers a way to circumvent the problem from a
| software view (and spilling to a large stack/heap). I guess it will
| work with C99. It might also be directly usable in a JIT setting,
| however, in general, the m argument (size) will not be known at
| compile time.
Note that I was just clarifying John's point about array sizes not being in any way
known in functions taking arrays, pointing out one obscure bit of syntax that means
C does in theory provide a way to express a constraint on arrays. However,
I believe that _all_ it does is mean that if the size isn't met by the actual arguments
then you're in the realm of undefined behaviour. In particular, it's about allowing
a compiler to do things it couldn't validly otherwise do (loading elements out-of-order, etc)
so that a conservative compiler can choose to just ignore it. I'd certainly be hesitant about
relying on anything beyond those semantics.
> 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".
That quote is from 184.108.40.206 of the C standard, and as far as I can see that's
_all_ the compiler is allowed to infer from it.
More information about the cfe-dev