Recursive Structure Type

Hi,

I am wondering about this IR:

%struct.__sFILE = type { %struct.__sFILE }

This seems invalid to me (but one may consider that the structure it just empty maybe?), but test/Verifier/recursive-struct-param.ll was committed while back to ensure the verifier accepts it.

LangRef says "Identified types can be recursive”, which I always read as with an implicit “through a pointer”.

So, what is the intention here? Do we support this construct? (Bonus: what is the use case?).

If we support this, we should fix the bitcode reader:

$ opt test/Verifier/recursive-struct-param.ll | opt
error: Invalid TYPE table: Only named structs can be forward referenced (Producer: 'LLVM4.0.0svn' Reader: 'LLVM 4.0.0svn’)

Hi,

I am wondering about this IR:

%struct.__sFILE = type { %struct.__sFILE }

This seems invalid to me (but one may consider that the structure it just empty maybe?), but test/Verifier/recursive-struct-param.ll was committed while back to ensure the verifier accepts it.

LangRef says "Identified types can be recursive”, which I always read as with an implicit “through a pointer”.

So, what is the intention here? Do we support this construct? (Bonus: what is the use case?).

I can’t imagine supporting it working when you actually try to use it.

What would you return for DataLayout.getStructLayout()->getSizeInBytes() for example?

Pete