Bitcast to [0 x Type]*

Hi,

I see many statements like the one following, with casts to a 0-sized array.
%10 = getelementptr inbounds [0 x %struct.Link]* bitcast ([497 x %struct.Link]* @link_array to [0 x %struct.Link]), i64 0, i64 %9 ; <%struct.Link> [#uses=1]

Why does this happen, and which transform causes this?

Arushi

Hi Arushi,

I see many statements like the one following, with casts to a 0-sized array.
  %10 = getelementptr inbounds [0 x %struct.Link]* bitcast ([497 x
%struct.Link]* @link_array to [0 x %struct.Link]*), i64 0, i64 %9 ;
<%struct.Link*> [#uses=1]

Why does this happen, and which transform causes this?

I don't think any transform generates such bitcasts. They are probably coming
from the original code: variable length arrays are usually represented by
[0 x element_type].

Ciao,

Duncan.