Skip to content
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

Fix crash when handling uninitialized resource type #6338

Merged
merged 6 commits into from
Feb 12, 2025

Conversation

kaizhangNV
Copy link
Contributor

close #6328.

When declare a var with struct type, if the struct has a resource type field and it doesn't provide explicit constructor, because slang won't implicit construct such variable at declare site if user doesn't explicitly call the initializer list, we should report the resource type field uninitialized as an error to prevent future possible crash when legalize any use of such variable.

@kaizhangNV kaizhangNV requested a review from a team as a code owner February 11, 2025 23:07
@kaizhangNV kaizhangNV self-assigned this Feb 11, 2025
@kaizhangNV kaizhangNV added the pr: non-breaking PRs without breaking changes label Feb 11, 2025
@kaizhangNV
Copy link
Contributor Author

/format

@slangbot
Copy link
Contributor

🌈 Formatted, please merge the changes from this PR

kaizhangNV added a commit to kaizhangNV/slang that referenced this pull request Feb 12, 2025
@cheneym2
Copy link
Collaborator

There is a typo in the message enum "Resouce":

useOfUninitializedResouceType

@kaizhangNV kaizhangNV force-pushed the uninit-resource-type branch 2 times, most recently from 4f8ccdd to 21c13f4 Compare February 12, 2025 00:56
source/slang/slang-diagnostic-defs.h Outdated Show resolved Hide resolved
source/slang/slang-legalize-types.cpp Show resolved Hide resolved
source/slang/slang-ir-legalize-types.cpp Outdated Show resolved Hide resolved
close shader-slang#6328.

When declare a var with struct type, if the struct has a resource
type field and it doesn't provide explicit constructor, because
slang won't implicit construct such variable at declare site if user
doesn't explicitly call the initializer list, we should report the
resource type field uninitialized as an error to prevent future possible
crash when legalize any use of such variable.
csyonghe
csyonghe previously approved these changes Feb 12, 2025
source/slang/slang-ir-legalize-types.cpp Show resolved Hide resolved
source/slang/slang-legalize-types.cpp Outdated Show resolved Hide resolved
@kaizhangNV kaizhangNV merged commit 3f102af into shader-slang:master Feb 12, 2025
16 checks passed
@kaizhangNV kaizhangNV deleted the uninit-resource-type branch February 12, 2025 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: non-breaking PRs without breaking changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default member initialization crashes compiler
4 participants