[Beignet] [PATCH] Fix a segment fault.

Song, Ruiling ruiling.song at intel.com
Fri Oct 10 01:00:02 PDT 2014


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

> -----Original Message-----
> From: Beignet [mailto:beignet-bounces at lists.freedesktop.org] On Behalf Of
> Yang Rong
> Sent: Thursday, October 09, 2014 1:57 PM
> To: beignet at lists.freedesktop.org
> 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 <rong.r.yang at intel.com>
> ---
>  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
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list