You are right, it may return NULL, the patch LGTM

> -----Original Message-----
> From: Beignet [mailto:[email protected]] On Behalf Of
> Yang Rong
> Sent: Thursday, October 09, 2014 1:57 PM
> To: [email protected]
> Cc: Yang, Rong R
> Subject: [Beignet] [PATCH] Fix a segment fault.
> 
> llvm::CallInst::CallInst::getCalledFunction may return NULL, can't call
> getIntrinsicID directly.
> 
> Signed-off-by: Yang Rong <[email protected]>
> ---
>  backend/src/llvm/llvm_bitcode_link.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/backend/src/llvm/llvm_bitcode_link.cpp
> b/backend/src/llvm/llvm_bitcode_link.cpp
> index 1365b32..7ef6a8a 100644
> --- a/backend/src/llvm/llvm_bitcode_link.cpp
> +++ b/backend/src/llvm/llvm_bitcode_link.cpp
> @@ -94,7 +94,8 @@ namespace gbe
>            continue;
>          }
> 
> -        if (call->getCalledFunction()->getIntrinsicID() != 0)
> +        if (call->getCalledFunction() &&
> +            call->getCalledFunction()->getIntrinsicID() != 0)
>            continue;
> 
>          Value *Callee = call->getCalledValue();
> --
> 1.9.1
> 
> _______________________________________________
> Beignet mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/beignet
_______________________________________________
Beignet mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/beignet

Reply via email to