public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/99184] New: [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7
@ 2021-02-20 22:40 avr at gjlay dot de
2022-09-18 16:53 ` [Bug target/99184] " gjl at gcc dot gnu.org
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: avr at gjlay dot de @ 2021-02-20 22:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99184
Bug ID: 99184
Summary: [avr] wrong double to 16-Bit and 32-Bit integers in
libgcc/libf7
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: avr at gjlay dot de
Target Milestone: ---
Casting from double to 32-bit and 16-bit integers incorrectly rounds to
nearest.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/99184] [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7
2021-02-20 22:40 [Bug target/99184] New: [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7 avr at gjlay dot de
@ 2022-09-18 16:53 ` gjl at gcc dot gnu.org
2022-09-19 7:50 ` cvs-commit at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: gjl at gcc dot gnu.org @ 2022-09-18 16:53 UTC (permalink / raw)
To: gcc-bugs
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;
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/99184] [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7
2021-02-20 22:40 [Bug target/99184] New: [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7 avr at gjlay dot de
2022-09-18 16:53 ` [Bug target/99184] " gjl at gcc dot gnu.org
@ 2022-09-19 7:50 ` cvs-commit at gcc dot gnu.org
2022-09-19 7:52 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-19 7:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99184
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:0b5b8ac5cb7fe92dd17ae8bd7de84640daa59e84
commit r13-2719-g0b5b8ac5cb7fe92dd17ae8bd7de84640daa59e84
Author: Georg-Johann Lay <avr@gjlay.de>
Date: Mon Sep 19 09:46:58 2022 +0200
Fix PR target/99184: Wrong cast from double to 16-bit and 32-bit ints
this patch fixed PR target/99184 which incorrectly rounded during 64-bit
(long) double to 16-bit and 32-bit integers.
The patch just removes the respective roundings from
libf7-asm.sx::to_integer and ::to_unsigned. Luckily, LibF7 does nowhere
use respective functions internally, the only user is in libf7.c::f7_exp
which reads
f7_round (qq, qq);
int16_t q = f7_get_s16 (qq);
so that f7_get_s16() operates on an already rounded value, and therefore
this code works unaltered with or without rounding in to_integer.
PR target/99184
libgcc/config/avr/libf7/
* libf7-asm.sx (to_integer, to_unsigned): Don't round 16-bit
and 32-bit integers.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/99184] [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7
2021-02-20 22:40 [Bug target/99184] New: [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7 avr at gjlay dot de
2022-09-18 16:53 ` [Bug target/99184] " gjl at gcc dot gnu.org
2022-09-19 7:50 ` cvs-commit at gcc dot gnu.org
@ 2022-09-19 7:52 ` cvs-commit at gcc dot gnu.org
2022-09-19 7:52 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-19 7:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99184
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:57896e8cddd2eb952145fa32ca25635fd63246b4
commit r12-8773-g57896e8cddd2eb952145fa32ca25635fd63246b4
Author: Georg-Johann Lay <avr@gjlay.de>
Date: Mon Sep 19 09:46:58 2022 +0200
Fix PR target/99184: Wrong cast from double to 16-bit and 32-bit ints
this patch fixed PR target/99184 which incorrectly rounded during 64-bit
(long) double to 16-bit and 32-bit integers.
The patch just removes the respective roundings from
libf7-asm.sx::to_integer and ::to_unsigned. Luckily, LibF7 does nowhere
use respective functions internally, the only user is in libf7.c::f7_exp
which reads
f7_round (qq, qq);
int16_t q = f7_get_s16 (qq);
so that f7_get_s16() operates on an already rounded value, and therefore
this code works unaltered with or without rounding in to_integer.
PR target/99184
libgcc/config/avr/libf7/
* libf7-asm.sx (to_integer, to_unsigned): Don't round 16-bit
and 32-bit integers.
(cherry picked from commit 0b5b8ac5cb7fe92dd17ae8bd7de84640daa59e84)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/99184] [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7
2021-02-20 22:40 [Bug target/99184] New: [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7 avr at gjlay dot de
` (2 preceding siblings ...)
2022-09-19 7:52 ` cvs-commit at gcc dot gnu.org
@ 2022-09-19 7:52 ` cvs-commit at gcc dot gnu.org
2022-09-19 7:53 ` cvs-commit at gcc dot gnu.org
2022-09-19 7:54 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-19 7:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99184
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:175d6ba5f025c886f7f81bc8f9b24717da978933
commit r11-10263-g175d6ba5f025c886f7f81bc8f9b24717da978933
Author: Georg-Johann Lay <avr@gjlay.de>
Date: Mon Sep 19 09:46:58 2022 +0200
Fix PR target/99184: Wrong cast from double to 16-bit and 32-bit ints
this patch fixed PR target/99184 which incorrectly rounded during 64-bit
(long) double to 16-bit and 32-bit integers.
The patch just removes the respective roundings from
libf7-asm.sx::to_integer and ::to_unsigned. Luckily, LibF7 does nowhere
use respective functions internally, the only user is in libf7.c::f7_exp
which reads
f7_round (qq, qq);
int16_t q = f7_get_s16 (qq);
so that f7_get_s16() operates on an already rounded value, and therefore
this code works unaltered with or without rounding in to_integer.
PR target/99184
libgcc/config/avr/libf7/
* libf7-asm.sx (to_integer, to_unsigned): Don't round 16-bit
and 32-bit integers.
(cherry picked from commit 0b5b8ac5cb7fe92dd17ae8bd7de84640daa59e84)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/99184] [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7
2021-02-20 22:40 [Bug target/99184] New: [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7 avr at gjlay dot de
` (3 preceding siblings ...)
2022-09-19 7:52 ` cvs-commit at gcc dot gnu.org
@ 2022-09-19 7:53 ` cvs-commit at gcc dot gnu.org
2022-09-19 7:54 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-09-19 7:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99184
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:848ddecfe14446947fe7697cdfafe0031c3c54c5
commit r10-10993-g848ddecfe14446947fe7697cdfafe0031c3c54c5
Author: Georg-Johann Lay <avr@gjlay.de>
Date: Mon Sep 19 09:46:58 2022 +0200
Fix PR target/99184: Wrong cast from double to 16-bit and 32-bit ints
this patch fixed PR target/99184 which incorrectly rounded during 64-bit
(long) double to 16-bit and 32-bit integers.
The patch just removes the respective roundings from
libf7-asm.sx::to_integer and ::to_unsigned. Luckily, LibF7 does nowhere
use respective functions internally, the only user is in libf7.c::f7_exp
which reads
f7_round (qq, qq);
int16_t q = f7_get_s16 (qq);
so that f7_get_s16() operates on an already rounded value, and therefore
this code works unaltered with or without rounding in to_integer.
PR target/99184
libgcc/config/avr/libf7/
* libf7-asm.sx (to_integer, to_unsigned): Don't round 16-bit
and 32-bit integers.
(cherry picked from commit 0b5b8ac5cb7fe92dd17ae8bd7de84640daa59e84)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug target/99184] [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7
2021-02-20 22:40 [Bug target/99184] New: [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7 avr at gjlay dot de
` (4 preceding siblings ...)
2022-09-19 7:53 ` cvs-commit at gcc dot gnu.org
@ 2022-09-19 7:54 ` rguenth at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-09-19 7:54 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99184
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.5
Resolution|--- |FIXED
Known to work| |10.4.1, 11.3.1, 12.2.1,
| |13.0
Status|UNCONFIRMED |RESOLVED
Known to fail| |10.4.0, 11.3.0, 12.2.0
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-09-19 7:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-20 22:40 [Bug target/99184] New: [avr] wrong double to 16-Bit and 32-Bit integers in libgcc/libf7 avr at gjlay dot de
2022-09-18 16:53 ` [Bug target/99184] " gjl at gcc dot gnu.org
2022-09-19 7:50 ` cvs-commit at gcc dot gnu.org
2022-09-19 7:52 ` cvs-commit at gcc dot gnu.org
2022-09-19 7:52 ` cvs-commit at gcc dot gnu.org
2022-09-19 7:53 ` cvs-commit at gcc dot gnu.org
2022-09-19 7:54 ` rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).