diff options
author | Matthew Bentham <matthew.bentham@arm.com> | 2021-07-05 15:45:25 +0100 |
---|---|---|
committer | Sadik Armagan <sadik.armagan@arm.com> | 2021-07-16 14:39:09 +0000 |
commit | 94df84d1e4964f00fbeaa29a720ef1822ba033d6 (patch) | |
tree | 15487f86c06dd3a2e563030cb5c1ee68f41f0684 /src/backends/reference | |
parent | c013bc85f45add8c4bc8c7163316bbb90b37a15e (diff) | |
download | armnn-94df84d1e4964f00fbeaa29a720ef1822ba033d6.tar.gz |
Avoid undefined behaviour in NumericCast unit test
Because the maximum value of an int32_t isn't exactly representable
by a 32-bit float, casting it to a float produces a greater value,
and then casting that back to an int32_t is undefined. (In tested
implementations the cast saturates, so accidentally the correct
result is returned).
Using double for the intermediate value instead gives a high
enough precision that this test case can be safely expressed.
Silences warning from Undefioned Behaviour Sanitiser.
Signed-off-by: Matthew Bentham <matthew.bentham@arm.com>
Change-Id: I6fe3e89cb6ac695049c92f3b75aca0c14d0e14aa
Diffstat (limited to 'src/backends/reference')
0 files changed, 0 insertions, 0 deletions