fuzzgen: Panic on failed NaN Canonicalization pass (#4896)
This should never fail anyway, but it's good to know that we aren't accidentally ignoring an input
This commit is contained in:
@@ -166,7 +166,7 @@ where
|
||||
Ok(inputs)
|
||||
}
|
||||
|
||||
fn run_func_passes(&self, func: Function) -> Result<Function> {
|
||||
fn run_func_passes(&self, func: Function) -> Function {
|
||||
// Do a NaN Canonicalization pass on the generated function.
|
||||
//
|
||||
// Both IEEE754 and the Wasm spec are somewhat loose about what is allowed
|
||||
@@ -189,16 +189,18 @@ where
|
||||
let flags = settings::Flags::new(settings::builder());
|
||||
let isa = builder_with_options(false)
|
||||
.expect("Unable to build a TargetIsa for the current host")
|
||||
.finish(flags)?;
|
||||
.finish(flags)
|
||||
.expect("Failed to build TargetISA");
|
||||
|
||||
ctx.canonicalize_nans(isa.as_ref())?;
|
||||
ctx.canonicalize_nans(isa.as_ref())
|
||||
.expect("Failed validation after NaN canonicalization");
|
||||
|
||||
Ok(ctx.func)
|
||||
ctx.func
|
||||
}
|
||||
|
||||
fn generate_func(&mut self) -> Result<Function> {
|
||||
let func = FunctionGenerator::new(&mut self.u, &self.config).generate()?;
|
||||
self.run_func_passes(func)
|
||||
Ok(self.run_func_passes(func))
|
||||
}
|
||||
|
||||
pub fn generate_test(mut self) -> Result<TestCase> {
|
||||
|
||||
Reference in New Issue
Block a user