Skip to content

[SYCL] Fix crash due to incorrect ReinterpretCastExpr generation #7030

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 4 commits into from
Oct 13, 2022

Conversation

Fznamznon
Copy link
Contributor

When creating ReinterpretCastExpr use getTrivialTypeSourceInfo instead of CreateTypeSourceInfo since CreateTypeSourceInfo doesn't initialize underlying memory. The crash appeared during recursive AST visitors walks if kernel argument type had a nested name specifier.

When creating `ReinterpretCastExpr` use `getTrivialTypeSourceInfo`
instead of `CreateTypeSourceInfo` since `CreateTypeSourceInfo` doesn't
initialize underlying memory. The crash appeared during recursive AST
visitors walks if kernel argument type had a nested name specifier.
@Fznamznon Fznamznon requested a review from a team as a code owner October 12, 2022 14:29
@premanandrao
Copy link
Contributor

This change looks good. Do we have CodeGen tests that check the initialization itself (its presence) so we could have caught it earlier?

@elizabethandrews
Copy link
Contributor

This change looks good. Do we have CodeGen tests that check the initialization itself (its presence) so we could have caught it earlier?

I don't think we had any test with nested types as arguments (either Sema or CodeGen) which is why we never caught this. This Sema test should be enough to test current crash but I agree it makes sense to add a test to check initialization as well - whether CodeGen or Sema

@Fznamznon
Copy link
Contributor Author

This Sema test should be enough to test current crash but I agree it makes sense to add a test to check initialization as well - whether CodeGen or Sema

Should this test be added as part of this PR or it can be added separately?

@elizabethandrews
Copy link
Contributor

This Sema test should be enough to test current crash but I agree it makes sense to add a test to check initialization as well - whether CodeGen or Sema

Should this test be added as part of this PR or it can be added separately?

Since its related to this fix, I think we can add it in this PR unless it will delay patch significantly.

@Fznamznon
Copy link
Contributor Author

This Sema test should be enough to test current crash but I agree it makes sense to add a test to check initialization as well - whether CodeGen or Sema

Should this test be added as part of this PR or it can be added separately?

Since its related to this fix, I think we can add it in this PR unless it will delay patch significantly.

Ok, done.

@Fznamznon
Copy link
Contributor Author

I suppose the new tests failed because b91b732 was merged. Will do a fix shortly.

@pvchupin pvchupin merged commit 7d9b5f5 into intel:sycl Oct 13, 2022
@Fznamznon
Copy link
Contributor Author

This broke Clang :: SemaSYCL/built-in-type-kernel-arg.cpp on Windows. Will do a fix shortly.

Fznamznon added a commit to Fznamznon/llvm that referenced this pull request Oct 13, 2022
On Windows kernel names are mangled in a different way.
steffenlarsen pushed a commit that referenced this pull request Oct 13, 2022
On Windows kernel names are mangled in a different way.
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.

5 participants