xls icon indicating copy to clipboard operation
xls copied to clipboard

Tests with single match arm

Open cdleary opened this issue 5 years ago • 2 comments

Really we should add generation of match constructs to the fuzzer. Found a bug in single-arm matches (just a single wildcard arm) where the JIT miscompares with the DSL.

cdleary avatar Aug 06 '20 03:08 cdleary

This was the test case that caused a miscompare between the JIT and the DSL interpreter:

fn [N: u8] p(_: bits[N]) -> u8 {                                                                                                                                                                                                                                                                                              
  N                                                                                                                                                                                                                                                                                                                           
}                                                                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                              
fn f() -> u8 {                                                                                                                                                                                                                                                                                                                
  match false {                                                                                                                                                                                                                                                                                                               
    _ => p(u8:0)                                                                                                                                                                                                                                                                                                              
  }                                                                                                                                                                                                                                                                                                                           
}                                                                                                                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                                                              
test t {                                                                                                                                                                                                                                                                                                                      
  assert_eq(u8:8, f())                                                                                                                                                                                                                                                                                                        
}

cdleary avatar Aug 06 '20 03:08 cdleary

Seems like a small bug with the degenerate case (only one thing to select) XLS->LLVM IR translation of one hot select.

cdleary avatar Aug 06 '20 18:08 cdleary