public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "macracan at yahoo dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/33611] New: Optimizations generate incorrect code Date: Mon, 01 Oct 2007 17:02:00 -0000 [thread overview] Message-ID: <bug-33611-15175@http.gcc.gnu.org/bugzilla/> (raw) The following snipped when compiled with -O0 generates a program that quickly finishes (correct behavior). But when compiled with any optimizations (-O1, -O2 or -O3) generates a program that never finishes. Variations on the code, (such as the comment line) geneate valid program with either level of optimization. Checked in 4.1.1 too (i386) and the bug is there too. Checked in 4.1.2 on x86_64 and the bug is NOT there. -- star of file aa.cpp struct A { unsigned int e; }; A a = {1}; double f[] = {0.0461109, 0.285433}; int main(void) { for (bool bEncore = true; bEncore; ) { bEncore = false; double p = 0.422244 * f[a.e]; // double p = 0.422244 * f[1]; if (f[0] < p) { f[0] = p; bEncore = true; } } return 0; } -- end of file aa.cpp g++ -O3 aa.cpp ./a.out --> goes into infinite loop -- Summary: Optimizations generate incorrect code Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: macracan at yahoo dot com GCC build triplet: GNU/linux i386/i686 GCC host triplet: GNU/linux i386/i686 GCC target triplet: GNU/linux i386/i686 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33611
next reply other threads:[~2007-10-01 17:02 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2007-10-01 17:02 macracan at yahoo dot com [this message] 2007-10-01 17:05 ` [Bug c++/33611] " macracan at yahoo dot com 2007-10-01 17:10 ` [Bug middle-end/33611] " pinskia at gcc dot gnu dot org 2007-10-01 17:16 ` [Bug middle-end/33611] [4.1/4.2/4.3 regression] " bangerth at dealii dot org 2007-10-01 17:43 ` macracan at yahoo dot com 2007-10-01 17:43 ` macracan at yahoo dot com
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-33611-15175@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).