Fix bugs related to varying pointers to functions that return void.
This commit is contained in:
3
ctx.cpp
3
ctx.cpp
@@ -3243,7 +3243,8 @@ FunctionEmitContext::CallInst(llvm::Value *func, const FunctionType *funcType,
|
|||||||
|
|
||||||
// Now, do a masked store into the memory allocated to
|
// Now, do a masked store into the memory allocated to
|
||||||
// accumulate the result using the call mask.
|
// accumulate the result using the call mask.
|
||||||
if (callResult != NULL) {
|
if (callResult != NULL &&
|
||||||
|
callResult->getType() != LLVMTypes::VoidType) {
|
||||||
Assert(resultPtr != NULL);
|
Assert(resultPtr != NULL);
|
||||||
StoreInst(callResult, resultPtr, callMask, returnType,
|
StoreInst(callResult, resultPtr, callMask, returnType,
|
||||||
PointerType::GetUniform(returnType));
|
PointerType::GetUniform(returnType));
|
||||||
|
|||||||
10
expr.cpp
10
expr.cpp
@@ -3586,13 +3586,17 @@ FunctionCallExpr::TypeCheck() {
|
|||||||
Assert(funcType->GetParameterDefault(i) != NULL);
|
Assert(funcType->GetParameterDefault(i) != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fptrType->IsVaryingType() &&
|
if (fptrType->IsVaryingType()) {
|
||||||
funcType->GetReturnType()->IsUniformType()) {
|
const Type *retType = funcType->GetReturnType();
|
||||||
|
if (Type::Equal(retType, AtomicType::Void) == false &&
|
||||||
|
retType->IsUniformType()) {
|
||||||
Error(pos, "Illegal to call a varying function pointer that "
|
Error(pos, "Illegal to call a varying function pointer that "
|
||||||
"points to a function with a uniform return type.");
|
"points to a function with a uniform return type \"%s\".",
|
||||||
|
funcType->GetReturnType()->GetString().c_str());
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (func == NULL || args == NULL)
|
if (func == NULL || args == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user