@@ -129,7 +129,7 @@ fn fuzz_range(start: u64, end: u64, threads: usize) {
129
129
// ... if that new file still produces the issue, copy it to `fuzz{seed}.rs`..
130
130
out_path. push ( & format ! ( "fuzz{next}.rs" ) ) ;
131
131
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.
133
133
reduce:: reduce ( & out_path) ;
134
134
}
135
135
// If the test passed, do nothing
@@ -225,7 +225,7 @@ fn release_gcc(path: &std::path::Path) -> Result<Vec<u8>, String> {
225
225
res. extend ( output. stderr ) ;
226
226
Ok ( res)
227
227
}
228
-
228
+ type ResultCache = Option < ( Vec < u8 > , Vec < u8 > ) > ;
229
229
/// Generates a new rustlantis file, & compares the result of running it with GCC and LLVM.
230
230
fn test ( seed : u64 , print_tmp_vars : bool ) -> Result < Result < ( ) , std:: path:: PathBuf > , String > {
231
231
// Generate a Rust source...
@@ -237,17 +237,17 @@ fn test(seed: u64, print_tmp_vars: bool) -> Result<Result<(), std::path::PathBuf
237
237
fn test_cached (
238
238
source_file : & Path ,
239
239
remove_tmps : bool ,
240
- cache : & mut Option < Vec < u8 > > ,
240
+ cache : & mut ResultCache ,
241
241
) -> 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 ...
248
243
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 ( ) ;
249
249
// ... compare the results ...
250
- if * llvm_res != gcc_res {
250
+ if * llvm_res != gcc_res && gcc_res == * old_gcc {
251
251
// .. if they don't match, report an error.
252
252
Ok ( Err ( source_file. to_path_buf ( ) ) )
253
253
} else {
0 commit comments