public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "zsojka at seznam dot cz" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/40747] New: [4.4/4.5 Regression] wrong code for int-is-in-range test at -O1 and above Date: Tue, 14 Jul 2009 16:32:00 -0000 [thread overview] Message-ID: <bug-40747-14164@http.gcc.gnu.org/bugzilla/> (raw) Tested with: trunk r149624 # ./gcc -v Using built-in specs. Target: x86_64-unknown-linux-gnu Configured with: ../configure --enable-languages=c,c++ --prefix=/mnt/svn/gcc-trunk/build/ Thread model: posix gcc version 4.5.0 20090714 (experimental) (GCC) and gentoo's 4.4.0, 4.5_alpha20090709 The following code is miscompiled ------------------------ // command line: gcc tst.c -c -o tst.o -O1 // or: with -m32 int f3(int i) { return (i < 4 && i >= 0) ? i : 4; } ------------------------ Resulting (relevant) asm is: ------------------------ f3: .LFB0: .cfi_startproc cmpl $4, %edi movl $4, %eax cmovle %edi, %eax ret .cfi_endproc ------------------------ For the following code: ------------------------ // command line: gcc tst.c -c -o tst.o -O1 // or: with -m32 #include <stdio.h> int f3(int i) { return (i < 4 && i >= 0) ? i : 4; } int main() { printf("%d %d %d\n", f3(-1), f3(2), f3(5)); } ------------------------ Result is "-1 2 4", but it should be "4 2 4" (as it is with -O0) -- Summary: [4.4/4.5 Regression] wrong code for int-is-in-range test at -O1 and above Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zsojka at seznam dot cz GCC host triplet: x86_64-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40747
next reply other threads:[~2009-07-14 16:32 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-07-14 16:32 zsojka at seznam dot cz [this message] 2009-07-14 16:36 ` [Bug c/40747] " zsojka at seznam dot cz 2009-07-14 17:16 ` sezeroz at gmail dot com 2009-07-14 17:26 ` jakub at gcc dot gnu dot org 2009-07-14 18:00 ` jakub at gcc dot gnu dot org 2009-07-15 7:32 ` [Bug middle-end/40747] " steven at gcc dot gnu dot org 2009-07-15 8:19 ` sezeroz at gmail dot com 2009-07-15 8:28 ` jakub at gcc dot gnu dot org 2009-07-15 8:30 ` jakub at gcc dot gnu dot org 2009-07-15 9:48 ` jakub at gcc dot gnu dot org 2009-07-15 10:18 ` jakub at gcc dot gnu dot org 2009-07-15 11:23 ` jakub at gcc dot gnu dot org 2009-07-15 11:26 ` jakub at gcc dot gnu dot org 2009-10-21 10:51 ` mikpe at it dot uu dot se
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-40747-14164@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).