This is the mail archive of the
`gcc@gcc.gnu.org`
mailing list for the GCC project.

# Re: numerical instability and estimate-probability

*From*: mike stump <mrs at windriver dot com>
*To*: gcc-pdo at atrey dot karlin dot mff dot cuni dot cz, gcc at gcc dot gnu dot org, jh at suse dot cz, rth at cygnus dot com
*Date*: Thu, 15 Nov 2001 11:31:52 -0800 (PST)
*Subject*: Re: numerical instability and estimate-probability

> Date: Thu, 15 Nov 2001 15:47:07 +0100
> From: Jan Hubicka <jh@suse.cz>
> To: gcc@gcc.gnu.org, rth@cygnus.com, gcc-pdo@atrey.karlin.mff.cuni.cz
> I am getting bootstrap comparison failure in i386 on the cfg-branch
> now. It is due to estimate-probability to have off-by-one error
> when computing the probability that causes tracer to behave
> differently.
> I am currently solving it by adding volatile to the variable so it
> is stored to memory and truncated each time it is seen. Would be
> such trick acceptable sollution or do we want to make better? What?
Ick!
It is advantageous to have gcc emit the same code, on different hosts
for the same source code. This currently works. (Last I checked.) I
don't favor people breaking this.
One can `fix' this by doing the arithmetic in double, doing it safely,
and then chopping the number down to say, 5 or 10 digits at the end.
This way increase the odds that the numbers will be the same of all
platforms, and that the same code will be generated. [ crossed
fingers we can do without a portible math library ]