[llvm] [Float2Int] Resolve FIXME: Pick the smallest legal type that fits (PR #79158)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 11:27:58 PDT 2024


alexfh wrote:

Thanks @joanahalili! I've reduced the example a bit more: https://godbolt.org/z/7z9n9GzEe

```
int main() {
    unsigned char result[10] = {};
    volatile int x = 1;
    int c = (x > 0) ? 1 : 0;
    result[3 + x] = static_cast<unsigned char>(255.f * c);
    return result[4];
}
```

The code compiled with clang after this commit returns 127, which is obviously wrong.

https://github.com/llvm/llvm-project/pull/79158


More information about the llvm-commits mailing list