...
Implementations with such trap representations are thought to have existed in the past. Your author was unable to locate any documents describing such processors.
INT31-C-EX3: ISO C, section 7.27.2.4, paragraph 3 says:
The time function returns the implementation’s best approximation to the current calendar time.
The value (time_t) (−1) is returned if the calendar time is not available.
If time_t
is an unsigned type, then the expression ((time_t) (-1))
is guaranteed to yield a large positive value.
Therefore, conversion of a negative compile-time constant to an unsigned value with the same or larger width is permitted by this rule. This exception does not apply to conversion of unsigned to signed values, nor does it apply if the resulting value would undergo truncation.
Risk Assessment
Integer truncation errors can lead to buffer overflows and the execution of arbitrary code by an attacker.
...