public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/96799] New: C and Ada frontends have a different interpretation of double constants
@ 2020-08-26 12:55 demoonlit at panathenaia dot halfmoon.jp
2020-09-28 9:29 ` [Bug ada/96799] " ebotcazou at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: demoonlit at panathenaia dot halfmoon.jp @ 2020-08-26 12:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96799
Bug ID: 96799
Summary: C and Ada frontends have a different interpretation of
double constants
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: demoonlit at panathenaia dot halfmoon.jp
Target Milestone: ---
Hello.
Each of the C and Ada frontends has a different interpretation of the some kind
of double constants.
Reproducing:
Write the same small double constants for each language.
double1.c
--------
const double d_min = 0x0.3ffffffffffffeP-1072;
--------
double2.ads
--------
package double2 is
d_min : constant Long_Float := 16#0.3ffffffffffffe#e-268;
end double2;
--------
(Note: These constants are the hexadecimal of __DBL_DENORM_MIN__ and wanted to
be rounded to the minimal value of double. The precise value is 0x0.4P-1072,
but __DBL_DENORM_MIN__ is a written as decimal, so these constants are got from
it by the conversion. This value is unimportant because perhaps this bug can be
reproduced with other values.)
Compile them.
$ gcc -W -Wall -S double1.c
$ gcc -W -Wall -S double2.ads
double2.ads:2:35: warning: floating-point value underflows to 0.0
Ada frontend reports the underflow. C frontend does not.
And compare double1.s and double2.s.
double1.s
--------
.text
.globl _d_min
.const
.align 3
_d_min:
.long 1 # <- It has been rounded.
.long 0
.ident "GCC: (GNU) 10.1.0"
.subsections_via_symbols
--------
double2.s
--------
.text
.globl _double2_E
.data
.align 1
_double2_E:
.space 2
.globl _double2__d_min
.const
.align 3
_double2__d_min:
.space 8 # <- It has been truncated.
.ident "GCC: (GNU) 10.1.0"
.subsections_via_symbols
--------
I first noticed it in the FreeBSD 32bit. FreeBSD 32bit has the lesser precision
of long double than other environments. However, then I tried it in FreeBSD
64bit, Linux, and MacOSX and it is reproducible too.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug ada/96799] C and Ada frontends have a different interpretation of double constants
2020-08-26 12:55 [Bug ada/96799] New: C and Ada frontends have a different interpretation of double constants demoonlit at panathenaia dot halfmoon.jp
@ 2020-09-28 9:29 ` ebotcazou at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: ebotcazou at gcc dot gnu.org @ 2020-09-28 9:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96799
Eric Botcazou <ebotcazou at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
CC| |ebotcazou at gcc dot gnu.org
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
C and Ada are different languages.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-28 9:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 12:55 [Bug ada/96799] New: C and Ada frontends have a different interpretation of double constants demoonlit at panathenaia dot halfmoon.jp
2020-09-28 9:29 ` [Bug ada/96799] " ebotcazou 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).