Bug ID 1127564
Summary gcc bug in double calculation in i586
Classification openSUSE
Product openSUSE Tumbleweed
Version Current
Hardware Other
OS Other
Status NEW
Severity Normal
Priority P5 - None
Component Development
Assignee bnc-team-screening@forge.provo.novell.com
Reporter alarrosa@suse.com
QA Contact qa-bugs@suse.de
Found By ---
Blocker ---

When building sphinxbase, I enabled the package checks and they built fine for
x86_64 but failed to run the tests on i586. After some debugging it looks like
a gcc error doing some calculations on i586. I made a small application to show
the problem:

  double p = 0.00053447623258905705;
  double inv_log_of_base = 10000.499991668185;

  int r = log(p) * inv_log_of_base;
  printf("a: %d\n", r);

  double gr = log(p) * inv_log_of_base;
  printf("b: %g\n", gr);

  double g = log(p);
  int c = g * inv_log_of_base;
  printf("c: %d\n", c);

The code above shows the following when built on x86_64:
a: -75346
b: -75346
c: -75346

but when built on i586 with -O0 it shows:
a: -75345
b: -75346
c: -75346

Note that when built on i586 with -O1, -O2, -O3 or -Og, it works fine, but
definitely, a different optimization parameter shouldn't change the result of a
multiplication.


You are receiving this mail because: