public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "slyfox at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/107879] New: [13 Regression] ffmpeg-4 test suite fails on FPU arithmetics Date: Sat, 26 Nov 2022 15:46:49 +0000 [thread overview] Message-ID: <bug-107879-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107879 Bug ID: 107879 Summary: [13 Regression] ffmpeg-4 test suite fails on FPU arithmetics Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org Target Milestone: --- Test failure is initially observed on ffmpeg-4.4.2 test suite where a bunch of tests started failing comparison against golden values. Extracted minimized example: // $ cat a.c /* Extracted from ffmpeg-4 test failure initially. How to reproduce: $ gcc-13/bin/gcc -O0 -lm a.c -o a -mfpmath=sse -fexcess-precision=standard -Wall -Wextra && ./a ... OK $ gcc-13/bin/gcc -O1 -lm a.c -o a -mfpmath=sse -fexcess-precision=standard -Wall -Wextra && ./a ... BUG */ #include <stdio.h> __attribute__((noinline, noipa)) static double build_filter(double * y) { volatile int ph = 0; volatile double vf = 1.0; double factor = vf; double x = - (double)ph * factor; /* should be -0.0 */ fprintf(stderr, "z = %f\n", x); /* prints -0.0, ok */ /* This 'if / else' code should not affect calculation of 'ffm', but removing it does change things. */ if (x == 0) *y = 1.0; /* should be 1.0 or .. */ else *y = 1.0 / x; /* -inf? */ fprintf(stderr, "*y = %f\n", *y); /* printf 1.0, ok */ double w = 2.0 * x / factor; /* should be -0.0 */ fprintf(stderr, "w = %f\n", w); /* prints -0.0, ok */ double omww = 1 - w; /* should be 1.0 */ fprintf(stderr, "omww = %f\n", omww); /* printf 1.0, ok */ double ffm = (omww > 0.0) ? omww : 0.0; /* should be 1.0 */ fprintf(stderr, "ffm = %f\n", ffm); /* printf 0.0 or 1.0, BUG */ return ffm; } int main() { double y = 42.0; double filter = build_filter(&y); fprintf(stderr, "f = %.20f; y = %.20f\n", filter, y); /* Should be 1.0, sometimes returns 0.0. */ fprintf(stderr, "%s\n", (filter > 0.5) ? "OK" : "BUG"); } How to reproduce: # -O0, good: $ gcc-HEAD/bin/gcc -O0 -lm a.c -o a -mfpmath=sse -fexcess-precision=standard -Wall -Wextra && ./a z = -0.000000 *y = 1.000000 w = -0.000000 omww = 1.000000 ffm = 1.000000 f = 1.00000000000000000000; y = 1.00000000000000000000 OK # -O1, bad: $ gcc-HEAD/bin/gcc -O1 -lm a.c -o a -mfpmath=sse -fexcess-precision=standard -Wall -Wextra && ./a z = -0.000000 *y = 1.000000 w = -0.000000 omww = 1.000000 ffm = 0.000000 f = 0.00000000000000000000; y = 1.00000000000000000000 BUG I think the code does not have anything controversial. Probably a code generation bug? $ LANG=C gcc-HEAD/bin/gcc -v Using built-in specs. COLLECT_GCC=/<<NIX>>/gcc-13.0.0/bin/gcc COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-13.0.0/libexec/gcc/x86_64-unknown-linux-gnu/13.0.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: Thread model: posix Supported LTO compression algorithms: zlib gcc version 13.0.0 20221126 (experimental) (GCC)
next reply other threads:[~2022-11-26 15:46 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-11-26 15:46 slyfox at gcc dot gnu.org [this message] 2022-11-26 16:23 ` [Bug middle-end/107879] " amonakov at gcc dot gnu.org 2022-11-26 16:40 ` [Bug tree-optimization/107879] " pinskia at gcc dot gnu.org 2022-11-26 17:20 ` slyfox at gcc dot gnu.org 2022-11-28 7:37 ` rguenth at gcc dot gnu.org 2022-11-28 10:55 ` jakub at gcc dot gnu.org 2022-11-28 13:57 ` jakub at gcc dot gnu.org 2022-11-28 19:09 ` jakub at gcc dot gnu.org 2022-11-28 22:44 ` slyfox at gcc dot gnu.org 2022-12-05 10:19 ` cvs-commit at gcc dot gnu.org 2022-12-05 10:36 ` jakub at gcc dot gnu.org 2022-12-05 11:31 ` amonakov at gcc dot gnu.org 2022-12-05 11:33 ` marxin at gcc dot gnu.org 2022-12-08 22:44 ` slyfox at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-107879-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).