From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/5111 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: Broken GCC versions: 4.8.2 and 4.9.0 Date: Sun, 11 May 2014 15:03:20 -0400 Message-ID: <20140511190320.GV26358@brightrain.aerifal.cx> References: <20140511010503.GA6502@brightrain.aerifal.cx> <20140511181020.0a8b66f1@free-electrons.com> <20140511161943.GR26358@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1399835080 8466 80.91.229.3 (11 May 2014 19:04:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 11 May 2014 19:04:40 +0000 (UTC) Cc: Thomas Petazzoni , musl@lists.openwall.com To: James Cloos Original-X-From: musl-return-5116-gllmg-musl=m.gmane.org@lists.openwall.com Sun May 11 21:04:32 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WjZ32-0002U9-Iu for gllmg-musl@plane.gmane.org; Sun, 11 May 2014 21:04:32 +0200 Original-Received: (qmail 5587 invoked by uid 550); 11 May 2014 19:04:31 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 5381 invoked from network); 11 May 2014 19:03:37 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:5111 Archived-At: On Sun, May 11, 2014 at 02:46:51PM -0400, James Cloos wrote: > What does the wrong assembly of your test code look like? xorl %eax,%eax ; ret > The assembly I get looks reasonable, in that it always references foo: > > The O3 version is: > > .file "test.c" > .text > .p2align 5,,31 > .globl bar > .type bar, @function > bar: > ..LFB0: > .cfi_startproc > movl foo(%rip), %edx > xorl %eax, %eax > testl %edx, %edx > setne %al > ret > .cfi_endproc > ..LFE0: > .size bar, .-bar > .section .rodata > .align 4 > .type dummy, @object > .size dummy, 4 > dummy: > .zero 4 > .weak foo > .set foo,dummy > .ident "GCC: (Gentoo 4.8.2-r1 p1.4-ssptest, pie-0.5.9-ssptest) 4.8.2" > .section .note.GNU-stack,"",@progbits > > Every version tests foo(%rip) and gets the result into %rax. > > The ia32, arm32 and arm64 assembly looks right, too. > > Perhaps distribution patches affect this? I've tested it on gcc.godbolt.org and others have tested with local gcc 4.8.2 and 4.9.0, probably distro-provided (I didn't ask). I wonder if the broken GCC is using isl/cloog (some third-party optimization library they hacked into gcc that's used only if it's available). That could explain it, especially since people who are building their own toolchains against musl do not seem to be experiencing the problem. Rich