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

Account for signedness in memset const pat #1143

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JulianKnodt
Copy link

@JulianKnodt JulianKnodt commented Apr 12, 2024

Fixes #1061

Thanks to LegNeato for pointing out what was wrong

@@ -315,7 +338,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
} else {
for index in 0..count {
let const_index = self.constant_u32(self.span(), index as u32);
let gep_ptr = self.gep(pat.ty, ptr, &[const_index]);
let gep_ptr = self.inbounds_gep(pat.ty, ptr, &[const_index]);
Copy link
Author

Choose a reason for hiding this comment

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

I added this because I assume that const memsets will always be in a valid range, but I'm not sure.

@LegNeato
Copy link
Contributor

Awesome, that was quick!!!! 😍

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.

Array init with 0i32 uses 0u32 instead.
2 participants