Bug 56831 - [x86] sNaN value as a function call argument
Summary: [x86] sNaN value as a function call argument
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: unknown
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-03 12:03 UTC by Thomas Schwinge
Modified: 2024-04-09 18:22 UTC (History)
0 users

See Also:
Host:
Target: i686
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-06-08 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Schwinge 2013-04-03 12:03:23 UTC
On 32-bit x86, using a sNaN value as a function call argument may turn it
into a qNaN (whilst raising an INVALID exception) already at the call
site, which is unexpected.  This is due to using a flds, fstps sequence
(which according to my old Intel manuals correctly processes a float and
double sNaN value in this way), instead of just using a movl for pushing
the sNaN value onto the stack.

This only happens for some optimization flags together with volatile
declaration of the variable keeping the sNaN value; see the discussion in
<http://news.gmane.org/find-root.php?message_id=%3c87txonzdtd.fsf%40kepler.schwinge.homeip.net%3e>
and thereabouts, and the SNAN_TESTS_float and SNAN_TESTS_double usage in
glibc commit 5aa4a1a1fd742479818a668d42d91ca9ec4a6318,
<http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=5aa4a1a1fd742479818a668d42d91ca9ec4a6318>.
Comment 1 Andrew Pinski 2016-06-08 17:48:20 UTC
Dup of bug 57484.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57484#c12 .

*** This bug has been marked as a duplicate of bug 57484 ***
Comment 2 Joseph S. Myers 2016-06-08 17:51:34 UTC
In my view, this is a valid quality-of-implementation bug that should be fixed: SFmode and DFmode values should only be loaded into x87 FPRs when arithmetic is to be carried out on them.