Skip to content

Commit

Permalink
[ubsan] Improve printing of value in shift_out_of_bounds
Browse files Browse the repository at this point in the history
Print it according to the type information we're given.
  • Loading branch information
heatd authored and travisg committed Feb 19, 2023
1 parent 36fd884 commit ca633e2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/ubsan/ubsan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,9 @@ void ubsan_handle_shift_out_of_bounds(const ubsan_shift_oob_data *data, ssize_t
}
else
{
printf("left shift of %zu by %zu places cannot be represented in type %s\n",
(size_t) lhs, (size_t) rhs, lhs_t->typename_);
val v{(size_t) lhs, lhs_t};
printf("left shift of %s by %zu places cannot be represented in type %s\n",
v.to_string().c_str(), (size_t) rhs, lhs_t->typename_);
}
}

Expand Down

0 comments on commit ca633e2

Please sign in to comment.