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/96693] New: GCC produces incorrect code with -O2 for loops Date: Tue, 18 Aug 2020 22:34:36 +0000 [thread overview] Message-ID: <bug-96693-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96693 Bug ID: 96693 Summary: GCC produces incorrect code with -O2 for loops 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: --- Error: >$ g++ -O2 driver.cpp func.cpp && ./a.out 0 >$ g++ -O0 driver.cpp func.cpp && ./a.out 42 Reproducer: //func.cpp extern char var_20; extern short var_22; void test(unsigned a, bool b, long long p12[23]) { for (int c = 0; c < 2;) { if (b) { for (int d = 0; d < 4082; d += 2) for (int e = 0; e < a; e = 2) var_20 = 0; var_22 = 0; } c = p12[c]; } } //driver.cpp #include <stdio.h> unsigned int var_4 = 140810747U; bool var_7 = (bool)0; unsigned char var_20 = (unsigned char)82; unsigned short var_22 = 42; long long int arr_9 [23] ; void test(unsigned int var_4, bool var_7, long long int arr_9 [23]); int main() { for (size_t i_0 = 0; i_0 < 23; ++i_0) arr_9 [i_0] = -722784397873599555LL; test(var_4, var_7, arr_9); printf("%d\n", var_22); } GCC version: 11.0.0 20200816 (23747614cc8fc137c1f2ca64c8e224125a72fae5) + fix proposed in bug 95396
next reply other threads:[~2020-08-18 22:34 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-18 22:34 vsevolod.livinskij at frtk dot ru [this message] 2020-08-25 10:58 ` [Bug tree-optimization/96693] [11 Regression] " rguenth at gcc dot gnu.org 2020-08-25 10:59 ` rguenth at gcc dot gnu.org 2020-08-25 12:47 ` rguenth 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-96693-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).