[all-commits] [llvm/llvm-project] 59510c: libclc: Fix rounding during type conversion

Daniel Stone via All-commits all-commits at lists.llvm.org
Thu Aug 19 22:24:56 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 59510c421208e178de63b3640787d02ad56deb37
      https://github.com/llvm/llvm-project/commit/59510c421208e178de63b3640787d02ad56deb37
  Author: Daniel Stone <daniels at collabora.com>
  Date:   2021-08-19 (Thu, 19 Aug 2021)

  Changed paths:
    M libclc/generic/lib/gen_convert.py

  Log Message:
  -----------
  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: Daniel Stone <daniels at collabora.com>

Reviewed By: jvesely

Differential Revision: https://reviews.llvm.org/D81999




More information about the All-commits mailing list