[LLVMdev] infinitely recursive named struct types

Nick Lewycky nicholas at mxc.ca
Thu Oct 6 20:29:08 PDT 2011


Chris Lattner wrote:
>
> On Oct 6, 2011, at 4:00 PM, NAKAMURA Takumi wrote:
>
>> Chris,
>>
>>>> Looks like it is possible to create an infinitely recursive struct type, llvm-as accepts this:
>>>> %s = type { i32, i8, %s }
>>>
>>> This should be illegal, and should probably be caught by the verifier.
>>
>> I suppose Edwin would like llvm to check (and let failed) in type
>> constructing, earlier than verifier.

I would like the verifier to catch all problems even in a build with 
asserts disabled. Also adding an assert is a great idea though.

Nick

>> I guess, such a insane type building might cause in various point,
>> ...to go in an infinite loop or stack overflow.
>
> There is a balance between time and cost of what happens in asserts and the verifier.  If it's fast and has good algorithmic complexity, I wouldn't object to it as an assert.
>
> -Chris
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>




More information about the llvm-dev mailing list