[Bug target/99184] [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7

gjl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Sep 18 16:53:29 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99184

--- Comment #1 from Georg-Johann Lay <gjl at gcc dot gnu.org> ---
As a work-around, one can cast to an intermediate 64-bit integer:

// For [u]int64_t and uint32_t, do #include <stdint.h>
double x = 2.9;
int x_int = (int) (int64_t) x;
uint32_t x_u32 = (uint32_t) (uint64_t) x;


More information about the Gcc-bugs mailing list