arcana-lab / memoir

A case for representing data collections and objects in the LLVM IR
MIT License
12 stars 2 forks source link

Incorrect StructTypeSummary #20

Closed peteryongzhong closed 2 years ago

peteryongzhong commented 2 years ago

In commit 9e68fb55177b1fd6bf295cc09b2fb6b9ec44af5f , the struct summary for test case test_correct_nested_type should return something like (struct uint64 (struct uint64 uint64 ) uint64 uint64 )

but the actual result is (struct uint64 (struct uint64 uint64 ) ) where the rest of the fields are ignored after a nested objected is inserted.

The objectlowering pass is modified to just print this out for this test case as a method of reproduction

tommymcm commented 2 years ago

This is not a bug, the program is incorrect. the defineStructType for "Bar" says that there are only 2 fields, when there actually 4. The correct definition should be:

Type *outerType = defineStructType("Bar",                                                                                                                                                                                                                                   
                                   4,                                                                                                                                                                                                                                       
                                   UInt64Type(),                                                                                                                                                                                                                            
                                   innerType,                                                                                                                                                                                                                               
                                   UInt64Type(),                                                                                                                                                                                                                            
                                   UInt64Type());
peteryongzhong commented 2 years ago

Oops that was dumb of me.