Synopsis: | Left shifts in constant expressions shall not be such as to truncate any bits from the result. |
Language: | C |
Severity Level: | 3 |
Category: | EXPRESSIONS |
Description: |
The left shift results in bits 'falling off' the end. Truncation of the constant expression value occurs as soon as 'occupied' bits start being shed. Up until this point the resultant value was representable.
Example: An artificial example but it demonstrates the loss of information (if constant expres-sions are represented in 4 bytes).#if (15u << 30) /* bits fall off end */ |