When indexing into a 0-sized array, if there were any subsequent indexes then the generated code would be incorrect (due to operator precedence).
This change removes these restrictions:
Detect the vector-index form and generate a vector of pointers.
Simplify and unify how indexes-after-the-first are generated to avoid the operator precedence issue.
At each step of indexing, always take the address of the expression - this allows uniform chaining of indexing (we can always assume the receiver is a pointer) and no special casing for the outermost expression (as we need to return a pointer).
Current support for the
getelementptr
instruction had two restrictions:This change removes these restrictions: