@@ -129,7 +129,7 @@ fn fuzz_range(start: u64, end: u64, threads: usize) {
129129 // ... if that new file still produces the issue, copy it to `fuzz{seed}.rs`..
130130 out_path. push ( & format ! ( "fuzz{next}.rs" ) ) ;
131131 std:: fs:: copy ( tmp_print_err, & out_path) . unwrap ( ) ;
132- // ... and start reducing it, using some propierites of `rustlantis` to speed up the process.
132+ // ... and start reducing it, using some properties of `rustlantis` to speed up the process.
133133 reduce:: reduce ( & out_path) ;
134134 }
135135 // If the test passed, do nothing
@@ -225,7 +225,7 @@ fn release_gcc(path: &std::path::Path) -> Result<Vec<u8>, String> {
225225 res. extend ( output. stderr ) ;
226226 Ok ( res)
227227}
228-
228+ type ResultCache = Option < ( Vec < u8 > , Vec < u8 > ) > ;
229229/// Generates a new rustlantis file, & compares the result of running it with GCC and LLVM.
230230fn test ( seed : u64 , print_tmp_vars : bool ) -> Result < Result < ( ) , std:: path:: PathBuf > , String > {
231231 // Generate a Rust source...
@@ -237,17 +237,17 @@ fn test(seed: u64, print_tmp_vars: bool) -> Result<Result<(), std::path::PathBuf
237237fn test_cached (
238238 source_file : & Path ,
239239 remove_tmps : bool ,
240- cache : & mut Option < Vec < u8 > > ,
240+ cache : & mut ResultCache ,
241241) -> Result < Result < ( ) , std:: path:: PathBuf > , String > {
242- if let None = cache {
243- // Test `source_file` with debug LLVM ...
244- * cache = Some ( debug_llvm ( & source_file) ?) ;
245- }
246- let llvm_res = cache. as_ref ( ) . unwrap ( ) ;
247- // ... test it with release GCC ...
242+ // Test `source_file` with release GCC ...
248243 let gcc_res = release_gcc ( & source_file) ?;
244+ if cache. is_none ( ) {
245+ // ...test `source_file` with debug LLVM ...
246+ * cache = Some ( ( debug_llvm ( & source_file) ?, gcc_res. clone ( ) ) ) ;
247+ }
248+ let ( llvm_res, old_gcc) = cache. as_ref ( ) . unwrap ( ) ;
249249 // ... compare the results ...
250- if * llvm_res != gcc_res {
250+ if * llvm_res != gcc_res && gcc_res == * old_gcc {
251251 // .. if they don't match, report an error.
252252 Ok ( Err ( source_file. to_path_buf ( ) ) )
253253 } else {
0 commit comments