Fix error not reported if at least one other error expected. (#485)
* fix error not reported if at least one other error expected. * Fixed unused extern crate error if wasm feature is not enabled. * No longer reporting deref cycles multiple times. * Fix filetest type_check.clif. * Switched comparison order for perf. * Fixed isa/riscv/verify-encoding.clif filetest.
This commit is contained in:
committed by
Dan Gohman
parent
9eee91fc12
commit
0e67255f52
@@ -7,7 +7,7 @@ function %RV32I(i32 link [%x1]) -> i32 link [%x1] {
|
|||||||
ebb0(v9999: i32):
|
ebb0(v9999: i32):
|
||||||
; iconst.i32 needs legalizing, so it should throw a
|
; iconst.i32 needs legalizing, so it should throw a
|
||||||
[R#0,-] v1 = iconst.i32 0xf0f0f0f0f0 ; error: Instruction failed to re-encode
|
[R#0,-] v1 = iconst.i32 0xf0f0f0f0f0 ; error: Instruction failed to re-encode
|
||||||
return v9999
|
[Iret#19] return v9999
|
||||||
}
|
}
|
||||||
|
|
||||||
function %RV32I(i32 link [%x1]) -> i32 link [%x1] {
|
function %RV32I(i32 link [%x1]) -> i32 link [%x1] {
|
||||||
@@ -17,5 +17,5 @@ ebb0(v9999: i32):
|
|||||||
v1 = iconst.i32 1
|
v1 = iconst.i32 1
|
||||||
v2 = iconst.i32 2
|
v2 = iconst.i32 2
|
||||||
[R#0,-] v3 = iadd v1, v2 ; error: encoding R#00 should be R#0c
|
[R#0,-] v3 = iadd v1, v2 ; error: encoding R#00 should be R#0c
|
||||||
return v9999
|
[Iret#19] return v9999
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ function %jump_args() {
|
|||||||
v0 = iconst.i16 10
|
v0 = iconst.i16 10
|
||||||
v3 = iconst.i64 20
|
v3 = iconst.i64 20
|
||||||
jump ebb1(v0, v3) ; error: arg 0 (v0) has type i16, expected i64
|
jump ebb1(v0, v3) ; error: arg 0 (v0) has type i16, expected i64
|
||||||
|
; error: arg 1 (v3) has type i64, expected i16
|
||||||
ebb1(v10: i64, v11: i16):
|
ebb1(v10: i64, v11: i16):
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -91,6 +92,7 @@ function %jump_args2() {
|
|||||||
v0 = iconst.i16 10
|
v0 = iconst.i16 10
|
||||||
v3 = iconst.i64 20
|
v3 = iconst.i64 20
|
||||||
brz v0, ebb1(v0, v3) ; error: arg 0 (v0) has type i16, expected i64
|
brz v0, ebb1(v0, v3) ; error: arg 0 (v0) has type i16, expected i64
|
||||||
|
; error: arg 1 (v3) has type i64, expected i16
|
||||||
jump ebb1(v3, v0)
|
jump ebb1(v3, v0)
|
||||||
ebb1(v10: i64, v11: i16):
|
ebb1(v10: i64, v11: i16):
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ extern crate cfg_if;
|
|||||||
extern crate capstone;
|
extern crate capstone;
|
||||||
extern crate clap;
|
extern crate clap;
|
||||||
extern crate cranelift_codegen;
|
extern crate cranelift_codegen;
|
||||||
extern crate cranelift_entity;
|
|
||||||
extern crate cranelift_filetests;
|
extern crate cranelift_filetests;
|
||||||
extern crate cranelift_reader;
|
extern crate cranelift_reader;
|
||||||
extern crate pretty_env_logger;
|
extern crate pretty_env_logger;
|
||||||
|
|
||||||
cfg_if! {
|
cfg_if! {
|
||||||
if #[cfg(feature = "wasm")] {
|
if #[cfg(feature = "wasm")] {
|
||||||
|
extern crate cranelift_entity;
|
||||||
extern crate cranelift_wasm;
|
extern crate cranelift_wasm;
|
||||||
extern crate term;
|
extern crate term;
|
||||||
extern crate wabt;
|
extern crate wabt;
|
||||||
|
|||||||
@@ -328,6 +328,7 @@ impl<'a> Verifier<'a> {
|
|||||||
// - cycles in the global value declarations.
|
// - cycles in the global value declarations.
|
||||||
// - use of 'vmctx' when no special parameter declares it.
|
// - use of 'vmctx' when no special parameter declares it.
|
||||||
fn verify_global_values(&self, errors: &mut VerifierErrors) -> VerifierStepResult<()> {
|
fn verify_global_values(&self, errors: &mut VerifierErrors) -> VerifierStepResult<()> {
|
||||||
|
let mut cycle_seen = false;
|
||||||
let mut seen = SparseSet::new();
|
let mut seen = SparseSet::new();
|
||||||
|
|
||||||
'gvs: for gv in self.func.global_values.keys() {
|
'gvs: for gv in self.func.global_values.keys() {
|
||||||
@@ -337,7 +338,10 @@ impl<'a> Verifier<'a> {
|
|||||||
let mut cur = gv;
|
let mut cur = gv;
|
||||||
while let ir::GlobalValueData::Deref { base, .. } = self.func.global_values[cur] {
|
while let ir::GlobalValueData::Deref { base, .. } = self.func.global_values[cur] {
|
||||||
if seen.insert(base).is_some() {
|
if seen.insert(base).is_some() {
|
||||||
|
if !cycle_seen {
|
||||||
report!(errors, gv, "deref cycle: {}", DisplayList(seen.as_slice()));
|
report!(errors, gv, "deref cycle: {}", DisplayList(seen.as_slice()));
|
||||||
|
cycle_seen = true; // ensures we don't report the cycle multiple times
|
||||||
|
}
|
||||||
continue 'gvs;
|
continue 'gvs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1511,6 +1515,7 @@ impl<'a> Verifier<'a> {
|
|||||||
pub fn run(&self, errors: &mut VerifierErrors) -> VerifierStepResult<()> {
|
pub fn run(&self, errors: &mut VerifierErrors) -> VerifierStepResult<()> {
|
||||||
self.verify_global_values(errors)?;
|
self.verify_global_values(errors)?;
|
||||||
self.typecheck_entry_block_params(errors)?;
|
self.typecheck_entry_block_params(errors)?;
|
||||||
|
|
||||||
for ebb in self.func.layout.ebbs() {
|
for ebb in self.func.layout.ebbs() {
|
||||||
for inst in self.func.layout.ebb_insts(ebb) {
|
for inst in self.func.layout.ebb_insts(ebb) {
|
||||||
self.ebb_integrity(ebb, inst, errors)?;
|
self.ebb_integrity(ebb, inst, errors)?;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ impl SubTest for TestVerifier {
|
|||||||
for expect in expected {
|
for expect in expected {
|
||||||
let pos = errors
|
let pos = errors
|
||||||
.iter()
|
.iter()
|
||||||
.position(|err| err.message.contains(expect.1) && err.location == expect.0);
|
.position(|err| err.location == expect.0 && err.message.contains(expect.1));
|
||||||
|
|
||||||
match pos {
|
match pos {
|
||||||
None => {
|
None => {
|
||||||
@@ -78,6 +78,11 @@ impl SubTest for TestVerifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// report remaining errors
|
||||||
|
for err in errors {
|
||||||
|
write!(msg, "unexpected error {}", err).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
if msg.is_empty() {
|
if msg.is_empty() {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user