public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug target/53138] New: [4.7/4.8 Regression] spaceship operator miscompiled @ 2012-04-27 9:27 bonzini at gnu dot org 2012-04-27 9:30 ` [Bug target/53138] " bonzini at gnu dot org ` (6 more replies) 0 siblings, 7 replies; 8+ messages in thread From: bonzini at gnu dot org @ 2012-04-27 9:27 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53138 Bug #: 53138 Summary: [4.7/4.8 Regression] spaceship operator miscompiled Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target AssignedTo: bonzini@gnu.org ReportedBy: bonzini@gnu.org Target: x86_64-pc-linux-gnu This program is miscompiled at -O2: typedef struct sreal { unsigned sig; /* Significant. */ int exp; /* Exponent. */ } sreal; sreal_compare (sreal *a, sreal *b) { if (a->exp > b->exp) return 1; if (a->exp < b->exp) return -1; if (a->sig > b->sig) return 1; return -(a->sig < b->sig); } sreal a[] = { { 0, 0 }, { 1, 0 }, { 0, 1 }, { 1, 1 } }; int main() { int i, j; for (i = 0; i <= 3; i++) { for (j = 0; j < 3; j++) { if (i < j && sreal_compare(&a[i], &a[j]) != -1) abort(); if (i == j && sreal_compare(&a[i], &a[j]) != 0) abort(); if (i > j && sreal_compare(&a[i], &a[j]) != 1) abort(); } } } The problem is that the comparison on sig is compiled to this: movl (%rsi), %ecx cmpl %ecx, (%rdi) sbbl %edx, %edx cmovbe %edx, %eax ret but sbbl only preserves the carry flag, not the zero flag. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/53138] [4.7/4.8 Regression] spaceship operator miscompiled 2012-04-27 9:27 [Bug target/53138] New: [4.7/4.8 Regression] spaceship operator miscompiled bonzini at gnu dot org @ 2012-04-27 9:30 ` bonzini at gnu dot org 2012-04-27 10:41 ` rguenth at gcc dot gnu.org ` (5 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: bonzini at gnu dot org @ 2012-04-27 9:30 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53138 Paolo Bonzini <bonzini at gnu dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2012-04-27 Ever Confirmed|0 |1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/53138] [4.7/4.8 Regression] spaceship operator miscompiled 2012-04-27 9:27 [Bug target/53138] New: [4.7/4.8 Regression] spaceship operator miscompiled bonzini at gnu dot org 2012-04-27 9:30 ` [Bug target/53138] " bonzini at gnu dot org @ 2012-04-27 10:41 ` rguenth at gcc dot gnu.org 2012-04-27 12:18 ` bonzini at gnu dot org ` (4 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: rguenth at gcc dot gnu.org @ 2012-04-27 10:41 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53138 Richard Guenther <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |4.7.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/53138] [4.7/4.8 Regression] spaceship operator miscompiled 2012-04-27 9:27 [Bug target/53138] New: [4.7/4.8 Regression] spaceship operator miscompiled bonzini at gnu dot org 2012-04-27 9:30 ` [Bug target/53138] " bonzini at gnu dot org 2012-04-27 10:41 ` rguenth at gcc dot gnu.org @ 2012-04-27 12:18 ` bonzini at gnu dot org 2012-04-30 8:58 ` [Bug target/53138] [4.7 " uros at gcc dot gnu.org ` (3 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: bonzini at gnu dot org @ 2012-04-27 12:18 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53138 --- Comment #1 from Paolo Bonzini <bonzini at gnu dot org> 2012-04-27 12:18:03 UTC --- Author: bonzini Date: Fri Apr 27 12:17:50 2012 New Revision: 186904 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186904 Log: 2012-04-27 Paolo Bonzini <bonzini@gnu.org> PR target/53138 * config/i386/i386.md (x86_mov<mode>cc_0_m1_neg): Add clobber. testsuite: 2012-04-27 Paolo Bonzini <bonzini@gnu.org> PR target/53138 * gcc.c-torture/execute/20120427-1.c: New testcase. Added: trunk/gcc/testsuite/gcc.c-torture/execute/20120427-1.c Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.md trunk/gcc/testsuite/ChangeLog ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/53138] [4.7 Regression] spaceship operator miscompiled 2012-04-27 9:27 [Bug target/53138] New: [4.7/4.8 Regression] spaceship operator miscompiled bonzini at gnu dot org ` (2 preceding siblings ...) 2012-04-27 12:18 ` bonzini at gnu dot org @ 2012-04-30 8:58 ` uros at gcc dot gnu.org 2012-04-30 9:56 ` uros at gcc dot gnu.org ` (2 subsequent siblings) 6 siblings, 0 replies; 8+ messages in thread From: uros at gcc dot gnu.org @ 2012-04-30 8:58 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53138 --- Comment #2 from uros at gcc dot gnu.org 2012-04-30 08:57:45 UTC --- Author: uros Date: Mon Apr 30 08:57:41 2012 New Revision: 186962 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186962 Log: Backport from mainline 2012-04-27 Paolo Bonzini <bonzini@gnu.org> PR target/53138 * config/i386/i386.md (x86_mov<mode>cc_0_m1_neg): Add clobber. testsuite/ChangeLog: Backport from mainline 2012-04-27 Paolo Bonzini <bonzini@gnu.org> PR target/53138 * gcc.c-torture/execute/20120427-1.c: New testcase. Added: branches/gcc-4_7-branch/gcc/testsuite/gcc.c-torture/execute/20120427-1.c Modified: branches/gcc-4_7-branch/gcc/ChangeLog branches/gcc-4_7-branch/gcc/config/i386/i386.md branches/gcc-4_7-branch/gcc/testsuite/ChangeLog ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/53138] [4.7 Regression] spaceship operator miscompiled 2012-04-27 9:27 [Bug target/53138] New: [4.7/4.8 Regression] spaceship operator miscompiled bonzini at gnu dot org ` (3 preceding siblings ...) 2012-04-30 8:58 ` [Bug target/53138] [4.7 " uros at gcc dot gnu.org @ 2012-04-30 9:56 ` uros at gcc dot gnu.org 2012-04-30 10:23 ` uros at gcc dot gnu.org 2012-04-30 10:27 ` ubizjak at gmail dot com 6 siblings, 0 replies; 8+ messages in thread From: uros at gcc dot gnu.org @ 2012-04-30 9:56 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53138 --- Comment #3 from uros at gcc dot gnu.org 2012-04-30 09:56:31 UTC --- Author: uros Date: Mon Apr 30 09:56:27 2012 New Revision: 186963 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186963 Log: Backport from mainline 2012-04-27 Paolo Bonzini <bonzini@gnu.org> PR target/53138 * config/i386/i386.md (x86_mov<mode>cc_0_m1_neg): Add clobber. testsuite/ChangeLog: Backport from mainline 2012-04-27 Paolo Bonzini <bonzini@gnu.org> PR target/53138 * gcc.c-torture/execute/20120427-1.c: New testcase. Added: branches/gcc-4_6-branch/gcc/testsuite/gcc.c-torture/execute/20120427-1.c Modified: branches/gcc-4_6-branch/gcc/ChangeLog branches/gcc-4_6-branch/gcc/config/i386/i386.md branches/gcc-4_6-branch/gcc/testsuite/ChangeLog ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/53138] [4.7 Regression] spaceship operator miscompiled 2012-04-27 9:27 [Bug target/53138] New: [4.7/4.8 Regression] spaceship operator miscompiled bonzini at gnu dot org ` (4 preceding siblings ...) 2012-04-30 9:56 ` uros at gcc dot gnu.org @ 2012-04-30 10:23 ` uros at gcc dot gnu.org 2012-04-30 10:27 ` ubizjak at gmail dot com 6 siblings, 0 replies; 8+ messages in thread From: uros at gcc dot gnu.org @ 2012-04-30 10:23 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53138 --- Comment #4 from uros at gcc dot gnu.org 2012-04-30 10:22:44 UTC --- Author: uros Date: Mon Apr 30 10:22:39 2012 New Revision: 186964 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186964 Log: Backport from mainline 2012-04-27 Paolo Bonzini <bonzini@gnu.org> PR target/53138 * config/i386/i386.md (x86_mov<mode>cc_0_m1_neg): Add clobber. testsuite/ChangeLog: Backport from mainline 2012-04-27 Paolo Bonzini <bonzini@gnu.org> PR target/53138 * gcc.c-torture/execute/20120427-1.c: New testcase. Added: branches/gcc-4_5-branch/gcc/testsuite/gcc.c-torture/execute/20120427-1.c Modified: branches/gcc-4_5-branch/gcc/ChangeLog branches/gcc-4_5-branch/gcc/config/i386/i386.md branches/gcc-4_5-branch/gcc/testsuite/ChangeLog ^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug target/53138] [4.7 Regression] spaceship operator miscompiled 2012-04-27 9:27 [Bug target/53138] New: [4.7/4.8 Regression] spaceship operator miscompiled bonzini at gnu dot org ` (5 preceding siblings ...) 2012-04-30 10:23 ` uros at gcc dot gnu.org @ 2012-04-30 10:27 ` ubizjak at gmail dot com 6 siblings, 0 replies; 8+ messages in thread From: ubizjak at gmail dot com @ 2012-04-30 10:27 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53138 Uros Bizjak <ubizjak at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED URL| |http://gcc.gnu.org/ml/gcc-p | |atches/2012-04/msg01745.htm | |l Resolution| |FIXED Target Milestone|4.7.1 |4.5.4 --- Comment #5 from Uros Bizjak <ubizjak at gmail dot com> 2012-04-30 10:26:48 UTC --- Fixed in 4.5.4+. ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2012-04-30 10:27 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-04-27 9:27 [Bug target/53138] New: [4.7/4.8 Regression] spaceship operator miscompiled bonzini at gnu dot org 2012-04-27 9:30 ` [Bug target/53138] " bonzini at gnu dot org 2012-04-27 10:41 ` rguenth at gcc dot gnu.org 2012-04-27 12:18 ` bonzini at gnu dot org 2012-04-30 8:58 ` [Bug target/53138] [4.7 " uros at gcc dot gnu.org 2012-04-30 9:56 ` uros at gcc dot gnu.org 2012-04-30 10:23 ` uros at gcc dot gnu.org 2012-04-30 10:27 ` ubizjak at gmail dot com
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).