Type convert NULL to other pointer types for function call arguments.
Fixes issue #198.
This commit is contained in:
4
expr.cpp
4
expr.cpp
@@ -3409,7 +3409,9 @@ FunctionCallExpr::TypeCheck() {
|
||||
if (t == NULL)
|
||||
return NULL;
|
||||
argTypes.push_back(t);
|
||||
argCouldBeNULL.push_back(lIsAllIntZeros(args->exprs[i]));
|
||||
|
||||
argCouldBeNULL.push_back(lIsAllIntZeros(args->exprs[i]) ||
|
||||
dynamic_cast<NullPointerExpr *>(args->exprs[i]) != NULL);
|
||||
}
|
||||
|
||||
FunctionSymbolExpr *fse = dynamic_cast<FunctionSymbolExpr *>(func);
|
||||
|
||||
14
tests/ptr-null-func-arg.ispc
Normal file
14
tests/ptr-null-func-arg.ispc
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
bool bar(float * x) {
|
||||
return (x != 0);
|
||||
}
|
||||
|
||||
export void f_f(uniform float RET[], uniform float aFOO[]) {
|
||||
RET[programIndex] = bar(NULL);
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 0;
|
||||
}
|
||||
Reference in New Issue
Block a user