-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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 uninitialized variable #89040
Fix uninitialized variable #89040
Conversation
Signed-off-by: Isha Agarwal <isha.agarwal@intel.com>
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write If you have received no comments on your PR for a week, you can request a review If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-backend-directx Author: Isha Agarwal (iagarwa) ChangesFix uninitialized scalar field Full diff: https://github.com/llvm/llvm-project/pull/89040.diff 1 Files Affected:
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index e8d03f806715f1..7ef858d0b393b6 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -427,7 +427,7 @@ struct ResourceBindInfo : public v0::ResourceBindInfo {
namespace v3 {
struct RuntimeInfo : public v2::RuntimeInfo {
- uint32_t EntryNameOffset;
+ uint32_t EntryNameOffset = 0;
void swapBytes() {
v2::RuntimeInfo::swapBytes();
|
@llvm/pr-subscribers-llvm-binary-utilities Author: Isha Agarwal (iagarwa) ChangesFix uninitialized scalar field Full diff: https://github.com/llvm/llvm-project/pull/89040.diff 1 Files Affected:
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index e8d03f806715f1..7ef858d0b393b6 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -427,7 +427,7 @@ struct ResourceBindInfo : public v0::ResourceBindInfo {
namespace v3 {
struct RuntimeInfo : public v2::RuntimeInfo {
- uint32_t EntryNameOffset;
+ uint32_t EntryNameOffset = 0;
void swapBytes() {
v2::RuntimeInfo::swapBytes();
|
@MalaySanghi @mahesh-attarde please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uh, why do we need to do this? None of the other data structures in this file initialize their values with inline initializers.
RuntimeInfo Objects are created only for v3 ones. That's why i initialize only EntryNameOffset |
Even if that were true (which it isn’t, we create a std::variant of the four versions), the change still doesn’t make sense. Why would we want to only initialize the last field of a large data structure? Is there an actual case where this caused an uninitialized value to be used, or is this just a speculative problem? |
@iagarwa Although I don't see a downside in initializing the field, I think you can ignore this. |
Not needed |
Fix uninitialized scalar field