-
Bug
-
Resolution: Fixed
-
Medium
-
Code Generation Tools
-
CODEGEN-10927
-
C6000_8.3.12
-
C6000_8.3.13
-
default
If the intrinsic _itof is passed an argument that is truncated to a size smaller than 32 bits, the compiler may incorrectly discard the truncation. This truncation can occur with a cast to short or a bit-mask to the lower 16 bits.
For example:
/* build with cl6x -mv6600 -O3 -s file.cpp */ #include <stdint.h> float bug(uint32_t a, uint32_t b) { const uint32_t lo16 = b & 0x0000FFFFU; return _itof(lo16); }
You'll get
bug: RETNOP B3,4 MV .L1X B4,A4
The & 0x0000ffff is ignored. So, if the input value has bits set in the upper 16-bits, they are incorrectly part of the result returned from the function.