Commit 59510c42 authored by Daniel Stone's avatar Daniel Stone Committed by Tom Stellard
Browse files

libclc: Fix rounding during type conversion



The rounding during type conversion uses multiple conversions, selecting
between them to try to discover if rounding occurred. This appears to
not have been tested, since it would generate code of the form:
    float convert_float_rtp(char x)
    {
      float r = convert_float(x);
      char y = convert_char(y);
      [...]
    }

which will access uninitialised data. The idea appears to have been to
have done a char -> float -> char roundtrip in order to discover the
rounding, so do this.

Discovered by inspection.

Signed-off-by: default avatarDaniel Stone <daniels@collabora.com>

Reviewed By: jvesely

Differential Revision: https://reviews.llvm.org/D81999
parent 9b0f292e
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment