Fix function pointers/delegates on Harvard architectures

Resolves issue #4432 by setting the address space of such IR pointers.
This commit is contained in:
Martin Kinkelin 2023-08-05 12:12:07 +02:00
parent 4d5553f545
commit 87b22436e4
4 changed files with 35 additions and 5 deletions

View file

@ -53,7 +53,8 @@ IrTypeDelegate *IrTypeDelegate::get(Type *t) {
IrFuncTy irFty(tf);
llvm::Type *ltf =
DtoFunctionType(tf, irFty, nullptr, Type::tvoid->pointerTo());
llvm::Type *types[] = {getVoidPtrType(), getPtrToType(ltf)};
llvm::Type *fptr = ltf->getPointerTo(gDataLayout->getProgramAddressSpace());
llvm::Type *types[] = {getVoidPtrType(), fptr};
LLStructType *lt = LLStructType::get(gIR->context(), types, false);
// Could have already built the type as part of a struct forward reference,