Attention is currently required from: Miklós Márton, Angel Pons, Anastasia Klimchuk.
1 comment:
File ni845x_spi.c:
Patch Set #1, Line 556: CS_number = CS_str[0] - '0';
Is underflow behavior defined for `unsigned char`?
The operands are first promoted to `int`, so technically this is a conversion
issue of the negative result. Which is defined as follows:
"[...] if the new type is unsigned, the value is converted by repeatedly adding or
subtracting one more than the maximum value that can be represented in the new type
until the value is in the range of the new type."
With a footnote:
"The rules describe arithmetic on the mathematical value, not the value of a given type of expression."
If it was a computation on `unsigned` types, this would apply:
"A computation involving unsigned operands can never overflow,
because a result that cannot be represented by the resulting unsigned integer type is
reduced modulo the number that is one greater than the largest value that can be
represented by the resulting type."
To view, visit change 56637. To unsubscribe, or for help writing mail filters, visit settings.