Bug 56828 - [PowerPC] Type cast of sNaN value
Summary: [PowerPC] Type cast of sNaN value
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: unknown
: P3 minor
Target Milestone: ---
Assignee: kelvin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-03 11:50 UTC by Thomas Schwinge
Modified: 2018-02-16 06:09 UTC (History)
1 user (show)

See Also:
Host:
Target: powerpc
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
snan.c (260 bytes, text/x-csrc)
2013-04-03 11:50 UTC, Thomas Schwinge
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schwinge 2013-04-03 11:50:49 UTC
Created attachment 29791 [details]
snan.c

On PowerPC, in versions of GCC up to at least 4.7.2, a type cast -- which
is a IEEE 754-2008 general-computational convertFormat operation (IEEE
754-2008, 5.4.2) -- does not turn a sNaN into a qNaN (whilst raising an
INVALID exception), which is contrary to IEEE 754-2008 5.1 and 7.2.

See the attached snan.c, for which I get for powerpc-linux-gnu-gcc -m64
(additionally specifying -fsignaling-nans doesn't make a difference):

    7ff40000 0 0 0
    7ff40000 0
    7ff40000 0
    7fe00000
    7fa00000

The second like should have been: 7ffc0000 0 (or
similar; top-most fraction bit (0x0008000) set).

See also the discussion in
<http://news.gmane.org/find-root.php?message_id=%3c5151E427.1080106%40linux.vnet.ibm.com%3e>
and thereabouts, and the SNAN_TESTS_TYPE_CAST usage in glibc commit
572676160d5639edc0ecb663147bd291841458d1,
<http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=572676160d5639edc0ecb663147bd291841458d1>.
Comment 1 Andrew Pinski 2013-04-03 12:10:37 UTC
long double on PPC is not exactly IEEE.
Comment 2 kelvin 2017-02-02 22:38:25 UTC
The default IBM extended precision long double type on Power does not conform to the IEEE specification, so there is no expectation that this type coercions would comply with the IEEE 754-2008 standard.