The UNSIGNED_8-based trick makes it possible to eliminates one branch but
relies on the wrap-around arithmetics of UNSIGNED_8. This size function
is then translated into a DWARF procedure, but the wrap-around arithmetics
is dropped on the floor, leading to a wrong size calculation when the DWARF
procedure is executed.
The fix also contains an optimization of unsigned comparisons in DWARF for
the case where the type is smaller than the "generic type" like here.
gcc/
* dwarf2out.cc (loc_list_from_tree_1) <CEIL_DIV_EXPR>; Add const.
<do_comp_binop>: Use a signed comparison for small unsigned types.
Implement wrap-around arithmetics for small integer types.