[Bug 1127564] New: gcc bug in double calculation in i586
http://bugzilla.opensuse.org/show_bug.cgi?id=1127564 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: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1127564 http://bugzilla.opensuse.org/show_bug.cgi?id=1127564#c1 --- Comment #1 from Antonio Larrosa <alarrosa@suse.com> --- Created attachment 798596 --> http://bugzilla.opensuse.org/attachment.cgi?id=798596&action=edit test.c source code I attach the test.c sources which can be built with "gcc test.c -o test -lm -O0" on any i586 obs chroot to reproduce this issue. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1127564 http://bugzilla.opensuse.org/show_bug.cgi?id=1127564#c2 --- Comment #2 from Antonio Larrosa <alarrosa@suse.com> --- Btw, in https://build.opensuse.org/request/show/680643 I submitted a workaround for the issue to sphinxbase . Note that the workarounds mentioned here for the test case didn't help for the package. Adding a line with printf("%g\n", g1); did "fix" it, but of course, adding a printf is not an option. So I ended up working around it by using temporary variables and an attribute to force O0 optimization on the problematic function. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.opensuse.org/show_bug.cgi?id=1127564 http://bugzilla.opensuse.org/show_bug.cgi?id=1127564#c3 Richard Biener <rguenther@suse.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |IN_PROGRESS See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=89573 --- Comment #3 from Richard Biener <rguenther@suse.com> --- Hmm, this is a strange case of excess-precision and resulting differences (x87 doubles have 80bit internal precision). Usually the solution is -fexcess-precision=standard but somehow that doesn't work for the multiplication-and-conversion-to-integer sequence. The "older" -ffloat-store workaround works fine though. Filed upstream. -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com