Skip to content

Commit

Permalink
accurate constant type for slice dummy data
Browse files Browse the repository at this point in the history
  • Loading branch information
vezenovm committed Mar 27, 2024
1 parent d202a08 commit b6cb2aa
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,9 +234,9 @@ impl<'a> ValueMerger<'a> {
/// such as with dynamic indexing of non-homogenous slices.
fn make_slice_dummy_data(&mut self, typ: &Type) -> ValueId {
match typ {
Type::Numeric(_) => {
Type::Numeric(numeric_type) => {
let zero = FieldElement::zero();
self.dfg.make_constant(zero, Type::field())
self.dfg.make_constant(zero, Type::Numeric(*numeric_type))
}
Type::Array(element_types, len) => {
let mut array = im::Vector::new();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "regression_sha256_slice"
type = "bin"
authors = [""]
compiler_version = ">=0.26.0"

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x = ["5", "10"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use dep::std;

fn main(x: [u8; 2]) {
let mut y = x.as_slice();
let digest1 = std::hash::sha256_slice(y);
let mut v = y;
if x[0] != 0 {
v = y.push_back(x[0]);
}
let digest2 = std::hash::sha256_slice(v);
assert(digest1 != digest2);
}

0 comments on commit b6cb2aa

Please sign in to comment.