Skip to content

Fix warning: 'inner_impl' may be used uninitialized - #612

Open
vksnk wants to merge 1 commit into
mainfrom
vksnk/warning
Open

Fix warning: 'inner_impl' may be used uninitialized#612
vksnk wants to merge 1 commit into
mainfrom
vksnk/warning

Conversation

@vksnk

@vksnk vksnk commented Mar 4, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

@vksnk
vksnk requested a review from dsharlet March 4, 2025 21:36

@dsharlet dsharlet left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really needs to remain uninitialized, it's worth optimizing every single cycle from this function.

Why doesn't `

Comment thread runtime/buffer.cc
// We need to replace the implementation of the last loop.
for_each_loop<BufsSize>* inner_loop = offset_bytes_non_null(loop, -sizeof_for_each_loop(bufs.size()));
assert(inner_impl);
(void)inner_impl;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why doesn't this solve the problem?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this fix unused, bit not unitialized?

Comment thread runtime/buffer.cc
}

for_each_loop_impl<BufsSize> inner_impl;
for_each_loop_impl<BufsSize> inner_impl = nullptr;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really wanted to leave this uninitialized, I'm trying to optimize every last cycle from this function.

@vksnk

vksnk commented Mar 4, 2025

Copy link
Copy Markdown
Collaborator Author

Okay, I tried some other ways to disable this warning, but none of them helped. There are some compiler specific ways to disable warnings for specific piece of code, but I guess we don't want them. I guess we can just ignore this warning, but I'm worrying it'll make it easier to miss some more important ones.

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.

2 participants