-
Notifications
You must be signed in to change notification settings - Fork 467
Add option to flag uninitialized integers as UB #1340
Copy link
Copy link
Closed
Labels
A-validationArea: This affects enforcing the validity invariant, and related UB checkingArea: This affects enforcing the validity invariant, and related UB checkingC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancement
Metadata
Metadata
Assignees
Labels
A-validationArea: This affects enforcing the validity invariant, and related UB checkingArea: This affects enforcing the validity invariant, and related UB checkingC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancement
Type
Fields
Give feedbackNo fields configured for issues without a type.
The reference currently states that this code is UB, but Miri deliberately accepts it:
The reason we accept it is that the lang-team is not sure if we really want this to be UB (also see rust-lang/unsafe-code-guidelines#71), so the conservative choice for the reference is to make it UB for now, but in Miri I fear this might lead to too many errors that people could consider false positives (even though by the letter of the reference they are true positives).
Still it could be interesting to see how much code (that Miri can run) actually fails when considering uninitialized integers UB, so having a flag in Miri to enable stricter checking would be interesting.