* Now diagnosing missing vmctx arguments (fixes #376). * Added filetest for fix of #376. * Respect formatting rules in verifier/mod.rs. * Added parameters for each use of vmctx in test files. * Added comments on additions on vmctx verifications.
This commit is contained in:
committed by
Dan Gohman
parent
e5014e0fff
commit
dd72b54eef
@@ -44,6 +44,7 @@
|
||||
//! Global values
|
||||
//!
|
||||
//! - Detect cycles in deref(base) declarations.
|
||||
//! - Detect use of 'vmctx' global value when no corresponding parameter is defined.
|
||||
//!
|
||||
//! TODO:
|
||||
//! Ad hoc checking
|
||||
@@ -170,7 +171,9 @@ impl<'a> Verifier<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
// Check for cycles in the global value declarations.
|
||||
// Check for:
|
||||
// - cycles in the global value declarations.
|
||||
// - use of 'vmctx' when no special parameter declares it.
|
||||
fn verify_global_values(&self) -> VerifierResult<()> {
|
||||
let mut seen = SparseSet::new();
|
||||
|
||||
@@ -186,6 +189,15 @@ impl<'a> Verifier<'a> {
|
||||
|
||||
cur = base;
|
||||
}
|
||||
|
||||
if let ir::GlobalValueData::VMContext { .. } = self.func.global_values[cur] {
|
||||
if self.func
|
||||
.special_param(ir::ArgumentPurpose::VMContext)
|
||||
.is_none()
|
||||
{
|
||||
return err!(cur, "undeclared vmctx reference {}", cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user