Commit a85352c5 by Enkelmann Committed by Enkelmann

fix 2 small bugs

parent e6db1887
...@@ -161,6 +161,9 @@ impl<T: RegisterDomain> RegisterDomain for DataDomain<T> { ...@@ -161,6 +161,9 @@ impl<T: RegisterDomain> RegisterDomain for DataDomain<T> {
fn subpiece(&self, low_byte: ByteSize, size: ByteSize) -> Self { fn subpiece(&self, low_byte: ByteSize, size: ByteSize) -> Self {
if let Self::Value(value) = self { if let Self::Value(value) = self {
Self::Value(value.subpiece(low_byte, size)) Self::Value(value.subpiece(low_byte, size))
} else if low_byte == ByteSize::new(0) && size == self.bytesize() {
// The operation is a no-op
self.clone()
} else { } else {
Self::new_top(size) Self::new_top(size)
} }
......
...@@ -34,9 +34,9 @@ impl<'a> crate::analysis::interprocedural_fixpoint::Context<'a> for Context<'a> ...@@ -34,9 +34,9 @@ impl<'a> crate::analysis::interprocedural_fixpoint::Context<'a> for Context<'a>
match &def.term { match &def.term {
Def::Store { address, value } => { Def::Store { address, value } => {
let mut state = state.clone(); let mut new_state = state.clone();
self.log_debug(state.handle_store(address, value), Some(&def.tid)); self.log_debug(new_state.handle_store(address, value), Some(&def.tid));
Some(state) Some(new_state)
} }
Def::Assign { var, value } => { Def::Assign { var, value } => {
let mut new_state = state.clone(); let mut new_state = state.clone();
......
...@@ -74,8 +74,9 @@ impl From<ByteSize> for apint::BitWidth { ...@@ -74,8 +74,9 @@ impl From<ByteSize> for apint::BitWidth {
} }
impl From<apint::BitWidth> for ByteSize { impl From<apint::BitWidth> for ByteSize {
/// Convert to `ByteSize`, while always rounding up to the nearest full byte.
fn from(bitwidth: apint::BitWidth) -> ByteSize { fn from(bitwidth: apint::BitWidth) -> ByteSize {
ByteSize::new(bitwidth.to_usize() as u64 / 8) ByteSize::new( (bitwidth.to_usize() + 7) as u64 / 8 )
} }
} }
......
...@@ -188,7 +188,7 @@ impl ExternSymbol { ...@@ -188,7 +188,7 @@ impl ExternSymbol {
if self.return_values.len() == 1 { if self.return_values.len() == 1 {
match self.return_values[0] { match self.return_values[0] {
Arg::Register(ref var) => Ok(var), Arg::Register(ref var) => Ok(var),
Arg::Stack { .. } => Err(anyhow!("Return value is passed on the stak")), Arg::Stack { .. } => Err(anyhow!("Return value is passed on the stack")),
} }
} else { } else {
Err(anyhow!("Wrong number of return values")) Err(anyhow!("Wrong number of return values"))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment