Skip to content

Correct regression introduced in ac021570

John Regan requested to merge jprjr/exhale:unaligned-read-regression into master

In ac021570, a series of 4 int8_t was cast into an int32_t, by casting each int8_t into a uint32_t and shifting by an appropriate number of bits, then casting back into int32_t.

It seems on GCC, when casting a negative int8_t into a uint32_t, the sign bit is extended into the rest of the value. So you can wind up with different values based on whether the integer is constructed using little-endian ordering or big-endian.

Since the goal of the code is to just check if the values are the same or not, this is replaced with a memcmp call.

Merge request reports

Loading