Bug 45273 - [4.9/5/6 Regression] The compiler depends on the host double (-fprofile-corection only)
Summary: [4.9/5/6 Regression] The compiler depends on the host double (-fprofile-corec...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.5.0
: P2 normal
Target Milestone: 4.9.4
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks: 45272
  Show dependency treegraph
 
Reported: 2010-08-13 00:54 UTC by Andrew Pinski
Modified: 2015-06-26 20:08 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2012-01-19 00:00:00


Attachments
Use mpfr in predict.c instead of sreal, and in mcf.c instead of host double (4.77 KB, patch)
2011-03-13 00:32 UTC, Steven Bosscher
Details | Diff
Use mpfr in predict.c instead of sreal, and in mcf.c instead of host double (5.17 KB, patch)
2011-03-13 12:39 UTC, Steven Bosscher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2010-08-13 00:54:59 UTC
While looking into PR 45272, I noticed it depends on the host double which is wrong, we should not depend on that.  The main reason is because different hosts could produce slightly different results depending on the behavior of float.

Oh Second mcf_sqrt depends on IEEE FP single precision.
Comment 1 Steven Bosscher 2010-08-13 07:22:47 UTC
Should use sreal, then?
Comment 2 Jakub Jelinek 2010-08-24 15:42:02 UTC
Well, we don't have sreal_sqrt, and the approximation mcf_sqrt uses is quite tied to the float representation, while it isn't impossible to convert it, I'd say it isn't trivial either.  Perhaps we could use mpfr instead.
Comment 3 Richard Biener 2010-08-30 15:57:37 UTC
I also see SIGFPEs recently on FDO SPEC 2000.
Comment 4 Steven Bosscher 2011-03-13 00:32:06 UTC
Created attachment 23643 [details]
Use mpfr in predict.c instead of sreal, and in mcf.c instead of host double

This completely untested patch shows what I'd like to do: Use mpfr instead of sreal and host double. Comments on the approach welcome.
Comment 5 Steven Bosscher 2011-03-13 10:55:05 UTC
Heh, with my patch (with some further changes) I get failures like this one:
../../trunk/gcc/sel-sched-ir.c:6253:1: error: caller edge frequency 38613 does not match BB frequency 38610

Excess precision? :-)
Comment 6 Steven Bosscher 2011-03-13 12:39:51 UTC
Created attachment 23644 [details]
Use mpfr in predict.c instead of sreal, and in mcf.c instead of host double

Bootstrapped&tested on x86_64-unknown-linux-gnu. Can be queued for GCC 4.7 if the Powers That Be agree this is the right approach.

The mcf.c parts can be posted separately for GCC 4.6 if necessary, but I propose to close this big as WONTFIX for older releases.
Comment 7 Richard Biener 2012-01-20 12:38:42 UTC
OTOH, nowadays all(?) host platforms we support have IEEE enough compliant
HW floating-point (well, details like signed zeros and NaNs/Infs are not
really relevant for GCC) that a hwfloat.h could provide a mapping to
a 32bit / 64bit IEEE float format?

Else the patch certainly looks good to me, but lets queue it for 4.8
(I remembered you posted patches to remove sreal.c, did you?)
Comment 8 stevenb.gcc@gmail.com 2012-01-20 19:17:53 UTC
Is there already a meta bug for patches queued for 4.8?
Comment 9 Jakub Jelinek 2013-03-22 14:43:29 UTC
GCC 4.8.0 is being released, adjusting target milestone.
Comment 10 Jakub Jelinek 2013-05-31 10:58:08 UTC
GCC 4.8.1 has been released.
Comment 11 Jakub Jelinek 2013-10-16 09:48:46 UTC
GCC 4.8.2 has been released.
Comment 12 Richard Biener 2014-05-22 09:02:30 UTC
GCC 4.8.3 is being released, adjusting target milestone.
Comment 13 Jakub Jelinek 2014-12-19 13:32:03 UTC
GCC 4.8.4 has been released.
Comment 14 Richard Biener 2015-06-23 08:14:27 UTC
The gcc-4_8-branch is being closed, re-targeting regressions to 4.9.3.
Comment 15 Jakub Jelinek 2015-06-26 19:56:35 UTC
GCC 4.9.3 has been released.