Skip to content

DPC++ daily 2021-12-21

Pre-release
Pre-release
Compare
Choose a tag to compare
@bb-sycl bb-sycl released this 21 Dec 19:28
· 136302 commits to sycl since this release
8c5b701
[SYCL][NFC] Fix static code analysis concerns (#5189)

Found via a static-analysis tool:
Suspicious dereference of pointer in function call before NULL check

Inside checkAllowedSYCLInitializer() in SemaSYCL.cpp file:

    const Expr *Init = VD->getInit();
    bool ValueDependent = Init->isValueDependent(); --> 'Init' is dereferenced by being passed as argument 0 to function "isValueDependent
    bool isConstantInit =
       Init && !ValueDependent && Init->isConstantInitializer(Context, false);  --> 'Init' is checked for NULL here

This patch adds NULL value checking for 'Init' expression.

Signed-off-by: Soumi Manna <[email protected]>