diff --git a/ctx.cpp b/ctx.cpp index 4f63aeea..8ca1e4a0 100644 --- a/ctx.cpp +++ b/ctx.cpp @@ -2484,6 +2484,12 @@ FunctionEmitContext::LoadInst(llvm::Value *ptr, llvm::Value *mask, AssertPos(currentPos, ptrType != NULL); } + if (CastType(ptrType->GetBaseType())) { + Error(currentPos, "Unable to load to undefined struct type \"%s\".", + ptrType->GetBaseType()->GetString().c_str()); + return NULL; + } + if (ptrType->IsUniformType()) { if (ptrType->IsSlice()) { return loadUniformFromSOA(ptr, mask, ptrType, name); @@ -2964,6 +2970,12 @@ FunctionEmitContext::StoreInst(llvm::Value *value, llvm::Value *ptr, AssertPos(currentPos, ptrType != NULL); } + if (CastType(ptrType->GetBaseType())) { + Error(currentPos, "Unable to store to undefined struct type \"%s\".", + ptrType->GetBaseType()->GetString().c_str()); + return; + } + // Figure out what kind of store we're doing here if (ptrType->IsUniformType()) { if (ptrType->IsSlice())