3

miri: Detect uninitialized integers and floats by camelid · Pull Request #88670...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/88670
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

@@ -212,6 +212,10 @@ struct ValidityVisitor<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> {

}

impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, 'tcx, M> {

fn allow_uninit_and_ptr_numbers(&self) -> bool {

!M::enforce_number_initialization(self.ecx)

Copy link

Member

Author

@camelid camelid 12 days ago

One thing that might be confusing about this is that enforce_number_initialization also controls whether pointer numbers are allowed. Should I rename enforce_number_initialization to something like enforce_number_validity (and maybe rename the Miri-the-tool flag too)?

I like enforce_number_validity. :)

Also, what is the point of introducing fn allow_uninit_and_ptr_numbers here?

Copy link

Member

Author

@camelid camelid 10 days ago

I like enforce_number_validity. :)

Ok, I'll rename to that :)

One thing though: will it be confusing because enforce_validity also exists?

Also, what is the point of introducing fn allow_uninit_and_ptr_numbers here?

It's not really necessary anymore; I'll remove it.

One thing though: will it be confusing because enforce_validity also exists?

On a broad level it seems consistent. It gets a bit subtle but I think we can handle this with comments/documentation.

Copy link

Member

Author

@camelid camelid 10 days ago

Yeah, and if we have to, we can rename the flag later too. Anyway, I updated this PR and the miri PR with the rename :)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK