public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug rtl-optimization/61673] New: [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 @ 2014-07-02 14:53 jakub at gcc dot gnu.org 2014-07-02 15:19 ` [Bug rtl-optimization/61673] " jakub at gcc dot gnu.org ` (4 more replies) 0 siblings, 5 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2014-07-02 14:53 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61673 Bug ID: 61673 Summary: [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 Product: gcc Version: 4.9.1 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: rtl-optimization Assignee: jakub at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org Target: s390-linux char e; __attribute__((noinline, noclone)) void foo (const char *x) { char d = x[0]; int c = d; if ((c >= 0 && c <= 0x7f) == 0) e = d; } int main () { const char c[] = { 0x54, 0x87 }; e = 0x21; foo (c); if (e != 0x21) __builtin_abort (); foo (c + 1); if (e != 0x87) __builtin_abort (); return 0; } is miscompiled supposedly starting with r202393. Before combine we have: (insn 7 6 8 2 (parallel [ (set (reg:SI 47 [ D.1404 ]) (and:SI (subreg:SI (reg/v:QI 44 [ d ]) 0) (const_int 255 [0xff]))) (clobber (reg:CC 33 %cc)) ]) gnutls2.c:8 455 {*andsi3_esa} (expr_list:REG_UNUSED (reg:CC 33 %cc) (nil))) (insn 8 7 9 2 (set (reg:CCU 33 %cc) (compare:CCU (reg:SI 47 [ D.1404 ]) (const_int 127 [0x7f]))) gnutls2.c:8 39 {*cmpsi_ccu} (expr_list:REG_DEAD (reg:SI 47 [ D.1404 ]) (nil))) (jump_insn 9 8 10 2 (set (pc) (if_then_else (leu (reg:CCU 33 %cc) (const_int 0 [0])) (label_ref:SI 15) (pc))) gnutls2.c:8 599 {*cjump_31} (expr_list:REG_DEAD (reg:CCU 33 %cc) (int_list:REG_BR_PROB 3900 (nil))) -> 15) and combine turns this into: (note 7 6 8 2 NOTE_INSN_DELETED) (insn 8 7 9 2 (parallel [ (set (reg:CCZ 33 %cc) (compare:CCZ (and:SI (subreg:SI (reg/v:QI 44 [ d ]) 0) (const_int -128 [0xffffffffffffff80])) (const_int 0 [0]))) (clobber (scratch:SI)) ]) gnutls2.c:8 453 {*andsi3_cconly} (nil)) (jump_insn 9 8 10 2 (set (pc) (if_then_else (eq (reg:CCZ 33 %cc) (const_int 0 [0])) (label_ref:SI 15) (pc))) gnutls2.c:8 599 {*cjump_31} (expr_list:REG_DEAD (reg:CCU 33 %cc) (int_list:REG_BR_PROB 3900 (nil))) -> 15) The -128 should have been 128, we want to test the sign bit of QImode rather than also any of the higher bits that contain garbage. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/61673] [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 2014-07-02 14:53 [Bug rtl-optimization/61673] New: [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 jakub at gcc dot gnu.org @ 2014-07-02 15:19 ` jakub at gcc dot gnu.org 2014-07-07 11:11 ` rguenth at gcc dot gnu.org ` (3 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2014-07-02 15:19 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61673 --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 33050 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33050&action=edit gcc49-pr61673.patch Untested fix. ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/61673] [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 2014-07-02 14:53 [Bug rtl-optimization/61673] New: [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 jakub at gcc dot gnu.org 2014-07-02 15:19 ` [Bug rtl-optimization/61673] " jakub at gcc dot gnu.org @ 2014-07-07 11:11 ` rguenth at gcc dot gnu.org 2014-07-08 15:40 ` jakub at gcc dot gnu.org ` (2 subsequent siblings) 4 siblings, 0 replies; 6+ messages in thread From: rguenth at gcc dot gnu.org @ 2014-07-07 11:11 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61673 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 Target Milestone|--- |4.9.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/61673] [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 2014-07-02 14:53 [Bug rtl-optimization/61673] New: [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 jakub at gcc dot gnu.org 2014-07-02 15:19 ` [Bug rtl-optimization/61673] " jakub at gcc dot gnu.org 2014-07-07 11:11 ` rguenth at gcc dot gnu.org @ 2014-07-08 15:40 ` jakub at gcc dot gnu.org 2014-07-08 15:44 ` jakub at gcc dot gnu.org 2014-07-08 15:55 ` jakub at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2014-07-08 15:40 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61673 --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Tue Jul 8 15:39:36 2014 New Revision: 212364 URL: https://gcc.gnu.org/viewcvs?rev=212364&root=gcc&view=rev Log: PR rtl-optimization/61673 * combine.c (simplify_comparison): Test just mode's sign bit in tmode rather than the sign bit and any bits above it. * gcc.c-torture/execute/pr61673.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/execute/pr61673.c Modified: trunk/gcc/ChangeLog trunk/gcc/combine.c trunk/gcc/testsuite/ChangeLog ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/61673] [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 2014-07-02 14:53 [Bug rtl-optimization/61673] New: [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 jakub at gcc dot gnu.org ` (2 preceding siblings ...) 2014-07-08 15:40 ` jakub at gcc dot gnu.org @ 2014-07-08 15:44 ` jakub at gcc dot gnu.org 2014-07-08 15:55 ` jakub at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2014-07-08 15:44 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61673 --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Tue Jul 8 15:43:39 2014 New Revision: 212365 URL: https://gcc.gnu.org/viewcvs?rev=212365&root=gcc&view=rev Log: PR rtl-optimization/61673 * combine.c (simplify_comparison): Test just mode's sign bit in tmode rather than the sign bit and any bits above it. * gcc.c-torture/execute/pr61673.c: New test. Added: branches/gcc-4_9-branch/gcc/testsuite/gcc.c-torture/execute/pr61673.c Modified: branches/gcc-4_9-branch/gcc/ChangeLog branches/gcc-4_9-branch/gcc/combine.c branches/gcc-4_9-branch/gcc/testsuite/ChangeLog ^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug rtl-optimization/61673] [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 2014-07-02 14:53 [Bug rtl-optimization/61673] New: [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 jakub at gcc dot gnu.org ` (3 preceding siblings ...) 2014-07-08 15:44 ` jakub at gcc dot gnu.org @ 2014-07-08 15:55 ` jakub at gcc dot gnu.org 4 siblings, 0 replies; 6+ messages in thread From: jakub at gcc dot gnu.org @ 2014-07-08 15:55 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61673 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |FIXED --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Fixed. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-07-08 15:55 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-07-02 14:53 [Bug rtl-optimization/61673] New: [4.9/4.10 Regression] Miscompilation of _gnutls_hostname_compare on s390 jakub at gcc dot gnu.org 2014-07-02 15:19 ` [Bug rtl-optimization/61673] " jakub at gcc dot gnu.org 2014-07-07 11:11 ` rguenth at gcc dot gnu.org 2014-07-08 15:40 ` jakub at gcc dot gnu.org 2014-07-08 15:44 ` jakub at gcc dot gnu.org 2014-07-08 15:55 ` jakub at gcc dot gnu.org
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).