public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "vsevolod.livinskij at frtk dot ru" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/98694] New: GCC produces incorrect code for loops with -O3 for skylake-avx512 and icelake-server Date: Fri, 15 Jan 2021 01:42:03 +0000 [thread overview] Message-ID: <bug-98694-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98694 Bug ID: 98694 Summary: GCC produces incorrect code for loops with -O3 for skylake-avx512 and icelake-server Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vsevolod.livinskij at frtk dot ru Target Milestone: --- The reproducer is a bit big, but I was not able to reduce it further. Reproducer: // func.cpp #include <algorithm> extern short var_1, var_29, var_89; extern unsigned var_2, var_11; extern bool var_4; extern long var_6; extern char var_7; extern int var_8, var_10; extern short arr_206[10][14][13][21][14] __attribute__((aligned)); extern int arr_257[]; long f(long l) { return 0 > l ? 0 : l; } void test() { var_11 = var_6; for (char a = 0; a < (char)var_2; a = 6) for (int b = 0; b < var_2; b = ~0) for (int c = 0; c < 2; c = var_1) for (bool d = 0; d < var_4; d = 1) var_29 = f(~var_6); for (short e = 0; e < short(var_6); e = var_6) { for (; 0 < (int)var_6;) ; for (char g = 0; g < 4; g++) for (; std::min(var_7 / 405077347810ULL, (unsigned long long)9); var_7 += 2) for (char h = 0; h < (char)var_8; h += 4) for (short i = 0; i < (var_4 && var_6) + 13; i++) { arr_206[0][g][0][h][i] = var_6; var_89 = std::min(var_4 ?: 709U, (unsigned)var_4); } for (short j = 0; j < var_2; j += 4) for (int k = 0; k < 5U; k = var_10) arr_257[k] = var_6; } } // driver.cpp #include <stdio.h> short var_1 = (short)7531; unsigned int var_2 = 187158918U; bool var_4 = (bool)1; unsigned long long int var_6 = 10263287916162477044ULL; signed char var_7 = 0; long long int var_8 = 21; unsigned int var_10 = 3309705747U; unsigned int var_11 = 222967114U; short var_29 = (short)-22723; short var_89 = (short)-19017; short arr_206 [10] [14] [13] [21] [14] __attribute__((aligned)); int arr_257 [5]; void test(); int main() { test(); for (size_t i_0 = 0; i_0 < 5; ++i_0) printf("%d ", arr_257 [i_0]); printf("\n"); } Error: >$ g++ -march=skylake-avx512 func.cpp driver.cpp -O2 && sde -skx -- ./a.out -2039714828 0 0 0 0 >$ g++ -march=skylake-avx512 func.cpp driver.cpp -O3 && sde -skx -- ./a.out 27636 0 0 0 0 gcc version 11.0.0 20210113 (8fc183ccd0628465205b8a88c29ab69bfe74a08a)
next reply other threads:[~2021-01-15 1:42 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-15 1:42 vsevolod.livinskij at frtk dot ru [this message] 2021-01-15 8:11 ` [Bug tree-optimization/98694] " crazylht at gmail dot com 2021-01-15 9:43 ` [Bug target/98694] " marxin at gcc dot gnu.org 2021-01-15 10:03 ` [Bug target/98694] [11 Regression] " rguenth at gcc dot gnu.org 2021-01-15 16:52 ` crazylht at gmail dot com 2021-01-15 16:56 ` crazylht at gmail dot com 2021-01-15 17:22 ` crazylht at gmail dot com 2021-01-15 17:33 ` crazylht at gmail dot com 2021-01-18 9:41 ` crazylht at gmail dot com 2021-01-21 5:30 ` cvs-commit at gcc dot gnu.org 2021-01-21 5:33 ` crazylht at gmail dot com 2021-01-21 9:41 ` [Bug target/98694] " rguenth at gcc dot gnu.org 2021-01-21 11:12 ` crazylht at gmail dot com 2021-05-05 17:48 ` jakub at gcc dot gnu.org 2022-05-10 8:17 ` cvs-commit at gcc dot gnu.org 2022-10-28 23:30 ` pinskia 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-98694-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).