Add an assertion in verifier.cpp to make sure gc_relocate relocate a gc pointer, and its return type has the same address space with the relocated pointer.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
I think we should assert that the address spaces of the source and destination pointers match. Also, please add a test case.
Comment Actions
Please add a test case for the first assert as well (i.e. a case where relocate is returning a non-pointer type).
Comment Actions
Hi Pat,
After some digging, I found that the first assert is actually unnecessary.
gc_relocate is defined to return a pointer type in intrinsics.td:
def int_experimental_gc_relocate : Intrinsic<[llvm_anyptr_ty], [llvm_i32_ty, llvm_i32_ty, llvm_i32_ty]>;
and verifier would verify it through VerifyIntrinsicType(). I think I will just modify the first assert to check the relocated value must be pointer type.
I will add two more tests. One to assert VerifyIntrinsicType() fails when gc_relocate's return type is not pointer type. Another one to assert relocated value is pointer type.
Does this sound good to you?