Bug 30580 - GCC doesn't set floating-point exceptions when performing fp<->int conversions
Summary: GCC doesn't set floating-point exceptions when performing fp<->int conversions
Status: RESOLVED DUPLICATE of bug 27682
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks: 16989
  Show dependency treegraph
 
Reported: 2007-01-24 22:03 UTC by Geoff Keating
Modified: 2010-10-05 18:30 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-12-26 16:07:30


Attachments
tflt2int.c testcase (6.41 KB, text/plain)
2007-01-24 22:04 UTC, Geoff Keating
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Geoff Keating 2007-01-24 22:03:08 UTC
The attached file, tflt2int.c, prints lots of errors and then "Failed with at least 223 failures" on powerpc-darwin, and according to the file fails on lots of other architectures with GCC as well (but with different numbers of failures).  It should pass.
Comment 1 Geoff Keating 2007-01-24 22:04:33 UTC
Created attachment 12952 [details]
tflt2int.c testcase

From <http://www.tybor.com/tflt2int.c>.
Comment 2 Andrew Pinski 2007-01-24 22:10:29 UTC
I thought those conversions are just undefined and don't raise exceptions.
Comment 3 Geoff Keating 2007-01-25 06:01:46 UTC
It's optional, but if you support Annex F of the C99 standard then F.4 says:

If the floating value is infinite or NaN or if the integral part of the floating value exceeds 
the range of the integer type, then the ‘‘invalid’’ floating-point exception is raised and the 
resulting value is unspecified.
Comment 4 Joseph S. Myers 2007-01-25 14:06:54 UTC
And indeed we should support Annex F in this regard.
Comment 5 Thomas Koenig 2008-12-26 16:07:30 UTC
Failing with 183 failures with

gcc -std=c99 foo.c -lm

on current trunk with x86_64-unknown-linux-gnu
Comment 6 Fred J. Tydeman 2010-10-05 18:28:05 UTC
I believe that this is a dup of bug 27682.
It still is failing in 4.5.1 on Intel Pentium 4 under Linux.
Comment 7 Andrew Pinski 2010-10-05 18:30:07 UTC
Yes I agree this is a dup of bug 27682.

*** This bug has been marked as a duplicate of bug 27682 ***