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/94727] New: GCC produces incorrect code with -O3 Date: Thu, 23 Apr 2020 05:14:39 +0000 [thread overview] Message-ID: <bug-94727-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94727 Bug ID: 94727 Summary: GCC produces incorrect code with -O3 Product: gcc Version: 10.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: --- GCC produces incorrect code with -O3. Reproducer: >$ cat func.cpp extern bool var_3; extern unsigned long long int var_11; extern unsigned char arr_41 [14] [14] [19] [16] [18] ; extern long long int arr_42 [14] [14] [19] [16] [18] ; void test() { for (int a = 0; a < 3; a++) for (char b = 0; b < 3; b = 4) for (int c = 0; c < 8; c++) for (short d = 0; d < 5; d += 4) for (char e = 0; e < 17; e++) arr_42[a][b][c][d][e] = (arr_41[a][b][c][d][e] < var_11) > var_3; } >$ cat driver.cpp #include <stdio.h> bool var_3 = (bool)0; unsigned long long int var_11 = 14035841137156193017ULL; unsigned char arr_41 [14] [14] [19] [16] [18] ; long long int arr_42 [14] [14] [19] [16] [18] ; void test(); int main() { for (size_t i_0 = 0; i_0 < 14; ++i_0) for (size_t i_1 = 0; i_1 < 14; ++i_1) for (size_t i_2 = 0; i_2 < 19; ++i_2) for (size_t i_3 = 0; i_3 < 16; ++i_3) for (size_t i_4 = 0; i_4 < 18; ++i_4) arr_41 [i_0] [i_1] [i_2] [i_3] [i_4] = (unsigned char)226; for (size_t i_0 = 0; i_0 < 14; ++i_0) for (size_t i_1 = 0; i_1 < 14; ++i_1) for (size_t i_2 = 0; i_2 < 19; ++i_2) for (size_t i_3 = 0; i_3 < 16; ++i_3) for (size_t i_4 = 0; i_4 < 18; ++i_4) arr_42 [i_0] [i_1] [i_2] [i_3] [i_4] = -5577957210778461327LL; test(); printf("%lld\n", arr_42[0][0][0][0][0]); } Error: >$ g++ func.cpp driver.cpp -O0 && ./a.out 1 >$ g++ func.cpp driver.cpp -O3 && ./a.out 0 GCC version: 10.0.1 (87841658d4fa5174d1797ee0abc73b3b3f11cad4)
next reply other threads:[~2020-04-23 5:14 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-23 5:14 vsevolod.livinskij at frtk dot ru [this message] 2020-04-23 5:35 ` [Bug tree-optimization/94727] [10 Regression] GCC produces incorrect code with -O3 since r10-5071-g02d895504cc59be0 marxin at gcc dot gnu.org 2020-04-23 6:44 ` rguenth at gcc dot gnu.org 2020-04-23 7:02 ` rguenth at gcc dot gnu.org 2020-04-23 7:34 ` rsandifo at gcc dot gnu.org 2020-04-23 10:26 ` rsandifo at gcc dot gnu.org 2020-04-23 12:35 ` rguenth at gcc dot gnu.org 2020-04-23 13:02 ` rsandifo at gcc dot gnu.org 2020-04-23 14:45 ` cvs-commit at gcc dot gnu.org 2020-04-23 14:48 ` rsandifo at gcc dot gnu.org 2020-04-28 7:04 ` cvs-commit 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-94727-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).