From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4650 invoked by alias); 13 Jul 2015 11:08:21 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 4142 invoked by uid 48); 13 Jul 2015 11:08:12 -0000 From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/58066] __tls_get_addr is called with misaligned stack on x86-64 Date: Mon, 13 Jul 2015 11:08:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 6.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg01028.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D58066 --- Comment #13 from Uro=C5=A1 Bizjak --- Created attachment 35964 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D35964&action=3Dedit Combined middle/end/target patch Patch in testing. >>From gcc-bugs-return-492139-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jul 13 11:11:00 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 8809 invoked by alias); 13 Jul 2015 11:10:59 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 8532 invoked by uid 48); 13 Jul 2015 11:10:56 -0000 From: "ubizjak at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/58066] __tls_get_addr is called with misaligned stack on x86-64 Date: Mon, 13 Jul 2015 11:10:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 6.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg01029.txt.bz2 Content-length: 3139 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D58066 --- Comment #14 from Uro=C5=A1 Bizjak --- (In reply to Uro=C5=A1 Bizjak from comment #13) > Patch in testing. This patch fixes the testcase, now we get: 0000000000000000 : 0: 41 56 push %r14 2: 41 55 push %r13 4: 44 0f b6 ef movzbl %dil,%r13d 8: 41 54 push %r12 a: 55 push %rbp b: 41 89 fc mov %edi,%r12d e: 53 push %rbx f: 89 fb mov %edi,%ebx 11: 41 c1 ec 10 shr $0x10,%r12d 15: 0f b6 c7 movzbl %bh,%eax 18: c1 eb 18 shr $0x18,%ebx 1b: 45 0f b6 e4 movzbl %r12b,%r12d 1f: 41 89 c6 mov %eax,%r14d 22: 48 8d 3d 00 00 00 00 lea 0(%rip),%rdi # 29 25: R_X86_64_TLSLD buffer+0xfffffffffffffffc 29: e8 00 00 00 00 callq 2e 2a: R_X86_64_PLT32=20=20=20=20=20 __tls_get_addr+0xfffffffffffffffc 2e: 48 83 ec 08 sub $0x8,%rsp 32: 48 8d 15 00 00 00 00 lea 0(%rip),%rdx # 39 35: R_X86_64_PC32 .LC0+0xfffffffffffffffc 39: 45 89 e1 mov %r12d,%r9d 3c: 48 8d a8 00 00 00 00 lea 0x0(%rax),%rbp 3f: R_X86_64_DTPOFF32 buffer 43: 53 push %rbx 44: 45 89 f0 mov %r14d,%r8d 47: 44 89 e9 mov %r13d,%ecx 4a: 31 c0 xor %eax,%eax 4c: be 12 00 00 00 mov $0x12,%esi 51: 48 89 ef mov %rbp,%rdi 54: e8 00 00 00 00 callq 59 55: R_X86_64_PLT32 __snprintf+0xffffffffffffff= fc 59: 58 pop %rax 5a: 48 89 e8 mov %rbp,%rax 5d: 5a pop %rdx 5e: 5b pop %rbx 5f: 5d pop %rbp 60: 41 5c pop %r12 62: 41 5d pop %r13 64: 41 5e pop %r14 66: c3 retq=20=20=20 The difference between patched (+++) and unpatched (---) code is: --- pr58066_.s 2015-07-13 11:58:23.000000000 +0200 +++ pr58066.s 2015-07-13 11:58:26.000000000 +0200 @@ -28,16 +28,16 @@ movzbl %bh, %eax shrl $24, %ebx movzbl %r12b, %r12d - subq $8, %rsp -.LCFI5: movl %eax, %r14d leaq buffer@tlsld(%rip), %rdi call __tls_get_addr@PLT - pushq %rbx -.LCFI6: + subq $8, %rsp +.LCFI5: leaq .LC0(%rip), %rdx movl %r12d, %r9d leaq buffer@dtpoff(%rax), %rbp + pushq %rbx +.LCFI6: movl %r14d, %r8d movl %r13d, %ecx xorl %eax, %eax HJ, can you please test the patch if it fixes your problem? >>From gcc-bugs-return-492140-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jul 13 11:14:11 2015 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 35926 invoked by alias); 13 Jul 2015 11:14:11 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 35882 invoked by uid 48); 13 Jul 2015 11:14:07 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/65709] [5 Regression] Bad code for LZ4 decompression with -O3 on x86_64 Date: Mon, 13 Jul 2015 11:14:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: INVALID X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 5.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-07/txt/msg01030.txt.bz2 Content-length: 795 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65709 --- Comment #15 from Jakub Jelinek --- I'm saying that if the program does not trigger undefined behavior (e.g. by accessing misaligned integers without telling the compiler about it (by using memcpy, or packed attribute or pragma), then it would be a compiler bug to use an instruction requiring higher alignment than guaranteed in the source, without ensuring such alignment (through realigning arrays, introducing a loop for aligning pointers before the vectorized loop, peeling a few iterations needed to align the pointer(s), or using instructions that don't require such high alignment). No testcase has been provided here without having undefined behavior in them that would show a bug on the compiler side.