From owner-freebsd-hackers@FreeBSD.ORG Sat May 19 23:55:12 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3A7891065675; Sat, 19 May 2012 23:55:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from springbank.echomania.com (andric.com [IPv6:2001:888:2003:1001:230:48ff:fe51:76b6]) by mx1.freebsd.org (Postfix) with ESMTP id BEC758FC0A; Sat, 19 May 2012 23:55:11 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at springbank.echomania.com Received: from [192.168.1.6] (tensor.andric.com [87.251.56.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by springbank.echomania.com (Postfix) with ESMTPSA id A3FC1A7071; Sun, 20 May 2012 01:54:51 +0200 (CEST) Message-ID: <4FB832DB.7070203@FreeBSD.org> Date: Sun, 20 May 2012 01:55:07 +0200 From: Dimitry Andric Organization: The FreeBSD Project User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:13.0) Gecko/20120425 Thunderbird/13.0 MIME-Version: 1.0 To: Gleb Kurtsou References: <20111119100150.GA1560@reks> <20111208090159.GA1924@cq1> <4EE0EB8C.7050800@freebsd.org> <6D023449-EDEA-4B1C-975D-54AA2F4328CE@semihalf.com> <20111209181550.GA3555@reks> <20111210012124.GA95149@reks> In-Reply-To: <20111210012124.GA95149@reks> X-Enigmail-Version: 1.5a1pre Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: mdf@freebsd.org, freebsd-hackers@freebsd.org, Piotr Nowak , Rafal Jaworowski , Nathan Whitehorn , Arnaud Lacombe , Ryan Stone Subject: Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 May 2012 23:55:12 -0000 On 2011-12-10 02:21, Gleb Kurtsou wrote: > Please find test case and test results attached. (gcc-test1.shar.txt) > > The long story short: only gcc-4.2 is affected, gcc 3.4, 4.4 and 4.6 are > ok. clang is ok. (test-cc.txt) > > Nearly all of the workarounds I used in original test doesn't work in > this test case (see #ifdef BAD_FIX in sources). > > gcc 4.2 fails even with -O1, it has nothing to do with > -fno-omit-frame-pointer, finline-functions, etc. (test-cflags.txt) > > Compile with -DFIX1 to work around problem (replace struct assignment > with memcpy): > % make test XFLAGS="-O2 -DFIX1" > rm -f gcc-test1 src1.o src2.o src3.o > cc -O2 -DFIX1 -g -std=gnu99 -c src1.c > cc -O2 -DFIX1 -g -std=gnu99 -c src2.c > cc -O2 -DFIX1 -g -std=gnu99 -c src3.c > cc -O2 -DFIX1 -g -std=gnu99 -o gcc-test1 src1.o src2.o src3.o > /home/gleb/projects/gcc-test1/gcc-test1 > ok > > Happy hacking! Hi Gleb, I did some bisecting, and I found the exact gcc trunk revision that fixes this bug: http://gcc.gnu.org/viewcvs?view=revision&revision=119760 So far the good news, now the bad news: this revision is actually a merge from gcc's mem-ssa branch! The full diff is almost 10,000 lines... Also, although it's still under GPLv2, the diff doesn't apply cleanly to our version. :(