Skip to content

[SYCL][NFC] Fix static code analysis concerns #2822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2020
Merged

Conversation

smanna12
Copy link
Contributor

@smanna12 smanna12 commented Nov 26, 2020

Found via a static-analysis tool:

Inside VisitTemplateTemplateArgument() function:

TemplateDecl *TD = TA.getAsTemplate.getAsTemplateDecl(); ----> Pointer 'TD' may be NULL
TemplateParameterList *TemplateParams = TD->getTemplateParameters(); ---> will be dereferenced here

This patch fixes null pointer dereference issues in SemaSYCL.cpp file by adding assert().

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

Found via a static-analysis tool:

Inside VisitTemplateTemplateArgument()

    TemplateDecl *TD = TA.getAsTemplate().getAsTemplateDecl(); --->Pointer 'TD' returned from call to function 'getAsTemplateDecl' may be NULL

    TemplateParameterList *TemplateParams = TD->getTemplateParameters(); --> will be dereferenced here

This patch fixes null pointer dereference issues in SemaSYCL.cpp file by adding assert().

Signed-off-by: Soumi Manna <[email protected]>
@smanna12 smanna12 marked this pull request as ready for review November 26, 2020 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants