Auto merge of #93670 - erikdesjardins:noundef, r=nikic
Apply noundef attribute to &T, &mut T, Box<T>, bool This doesn't handle `char` because it's a bit awkward to distinguish it from `u32` at this point in codegen. Note that this _does not_ change whether or not it is UB for `&`, `&mut`, or `Box` to point to undef. It only applies to the pointer itself, not the pointed-to memory. Fixes (partially) #74378. r? `@nikic` cc `@RalfJung`
This commit is contained in:
commit
5c30d65683
13 changed files with 94 additions and 91 deletions
|
@ -74,6 +74,7 @@ mod attr_impl {
|
|||
// or not to actually emit the attribute. It can also be controlled
|
||||
// with the `-Zmutable-noalias` debugging option.
|
||||
const NoAliasMutRef = 1 << 6;
|
||||
const NoUndef = 1 << 7;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -495,7 +496,11 @@ impl<'a, Ty> ArgAbi<'a, Ty> {
|
|||
// For non-immediate arguments the callee gets its own copy of
|
||||
// the value on the stack, so there are no aliases. It's also
|
||||
// program-invisible so can't possibly capture
|
||||
attrs.set(ArgAttribute::NoAlias).set(ArgAttribute::NoCapture).set(ArgAttribute::NonNull);
|
||||
attrs
|
||||
.set(ArgAttribute::NoAlias)
|
||||
.set(ArgAttribute::NoCapture)
|
||||
.set(ArgAttribute::NonNull)
|
||||
.set(ArgAttribute::NoUndef);
|
||||
attrs.pointee_size = layout.size;
|
||||
// FIXME(eddyb) We should be doing this, but at least on
|
||||
// i686-pc-windows-msvc, it results in wrong stack offsets.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue