commit | 80079c9c2f55ddfc5b1d5235d5ed6a2981fa6a97 | [log] [tgz] |
---|---|---|
author | Simon Tatham <simon.tatham@arm.com> | Fri Mar 14 11:57:25 2025 +0000 |
committer | GitHub <noreply@github.com> | Fri Mar 14 11:57:25 2025 +0000 |
tree | 492058f390611ccceacc0790a12c0b37fd7a5a47 | |
parent | e45090e5f0bf7743fe0b00d510a903a659354ce1 [diff] |
[libc] Fix new warning in DyadicFloat::as_mantissa_type_rounded (#131148) The affected line of code converts a float's exponent from `int` to `size_t`, negating it in the process. Following clang commit 773e88f9d61399c, this provokes a warning, presumably because the conversion goes wrong if `size_t` is wider than `int` and the input value is `INT_MIN`: negating it within the `int` type is undefined behavior, with the likely (though not guaranteed) effect of leaving it still at `INT_MIN` and then sign-extending that on promotion to `size_t`. This fix adds a cast so that the promotion to `size_t` happens _before_ the negation, so that the negative input value will _always_ be sign-extended, and then the negation will make it positive again. (I don't believe this case will actually come up. `DyadicFloat` is a helper system used in processing ordinary float formats, so nothing is expected to generate an exponent with even a 16-bit absolute value, let alone 31. But it's as easy to fix it to be robust as it is to just suppress the warning!)
Welcome to the LLVM project!
This repository contains the source code for LLVM, a toolkit for the construction of highly optimized compilers, optimizers, and run-time environments.
The LLVM project has multiple components. The core of the project is itself called “LLVM”. This contains all of the tools, libraries, and header files needed to process intermediate representations and convert them into object files. Tools include an assembler, disassembler, bitcode analyzer, and bitcode optimizer.
C-like languages use the Clang frontend. This component compiles C, C++, Objective-C, and Objective-C++ code into LLVM bitcode -- and from there into object files, using LLVM.
Other components include: the libc++ C++ standard library, the LLD linker, and more.
Consult the Getting Started with LLVM page for information on building and running LLVM.
For information on how to contribute to the LLVM project, please take a look at the Contributing to LLVM guide.
Join the LLVM Discourse forums, Discord chat, LLVM Office Hours or Regular sync-ups.
The LLVM project has adopted a code of conduct for participants to all modes of communication within the project.