From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 8 18:48:15 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 365D91065677 for ; Thu, 8 Dec 2011 18:48:15 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id DEA448FC18 for ; Thu, 8 Dec 2011 18:48:14 +0000 (UTC) Received: by qabg14 with SMTP id g14so1964808qab.13 for ; Thu, 08 Dec 2011 10:48:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; bh=vyxkBPYwCPm4bN2elkg4nm1L2+QuK6g9rT1/1IbIx70=; b=WXi2Gjjx/Zf0+1fyo8hezFbJhryRCnrmOFbxcEMDlLj6Pqnl7rqY2SQ2J63V6Jo/uM E8zbyDbDsv5BT9cri5chr2OejIKWnRbNSbS0Dxyp8bBJvFOPGL6OkEyxhqWp8Acib5nw 9AEGNDGHr1UTWMreFbbiPRI0pfvIy7MCSAe6w= Received: by 10.224.40.10 with SMTP id i10mr4154381qae.82.1323370094182; Thu, 08 Dec 2011 10:48:14 -0800 (PST) Received: from kan.dyndns.org (c-24-63-226-98.hsd1.ma.comcast.net. [24.63.226.98]) by mx.google.com with ESMTPS id j7sm11447817qaq.11.2011.12.08.10.48.12 (version=SSLv3 cipher=OTHER); Thu, 08 Dec 2011 10:48:12 -0800 (PST) Date: Thu, 8 Dec 2011 13:48:04 -0500 From: Alexander Kabaev To: Gleb Kurtsou Message-ID: <20111208134804.125d45a9@kan.dyndns.org> In-Reply-To: <20111119100150.GA1560@reks> References: <20111119100150.GA1560@reks> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.6; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/b8ycDU4=DG=WkJhmifOR5S4"; protocol="application/pgp-signature" Cc: freebsd-hackers@FreeBSD.org 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: Thu, 08 Dec 2011 18:48:15 -0000 --Sig_/b8ycDU4=DG=WkJhmifOR5S4 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sat, 19 Nov 2011 12:01:50 +0200 Gleb Kurtsou wrote: > Hi, >=20 > I was lucky to write a bit of code which gcc 4.2 fails to compile > correctly with -O2. Too keep long story short the code fails for gcc > from base system and last gcc 4.2 snapshot from ports. It works with > gcc 4.3, gcc 4.4 on FreeBSD and Linux. Clang from base is also good. > -O and -Os optimization levels are fine (I've tried with all -f* flags > mentioned in documentation) >=20 > -O2 -fno-omit-frame-pointer combination is troublesome on amd64. I > presume i386 should be fine. These options are also used for > compilation of kernel (with debugging enabled) and modules. >=20 > I'm not able to share the code, but have a test case reproducing the > bug. I've encountered the issue over a week ago and tried narrowing > it down to a simple test I could share but without much success. >=20 > The code itself is very common: initialize two structs on stack, call > a function with pointers to those stucts as arguments. A number of > inlined assertion functions. gcc fails to correctly optimize struct > assignments with -fno-omit-frame-pointer, I have a number of small > structs assigned, gcc decides not to use data coping but to assign > fields directly. I've tried disabling sra, tweaking sra parameters -- > no luck in forcing it to copy data. Replacing one particular > assignment with memcpy produces correct code, but that's not a > solution. >=20 > -O2 -fno-omit-frame-pointer -fno-inline is buggy > -O2 -fno-omit-frame-pointer -frename-registers is buggy >=20 > I found similar issue with gcc 4.6, but I'm not able to reproduce it > with gcc test case: > https://bugzilla.redhat.com/show_bug.cgi?id=3D679924 > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D47893 >=20 > I'll be glad to help debugging it and will be hanging on #bsddev > during weekend as glk. >=20 >=20 > Thanks, > Gleb. > _______________________________________________ It should take about ten times less time than this thread took already to isolate _short_ test case demonstrating the problem, yet nothing of the sort has shown up yet from anyone involved. Am I missing something? =20 --=20 Alexander Kabaev --Sig_/b8ycDU4=DG=WkJhmifOR5S4 Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (FreeBSD) iD8DBQFO4QZqQ6z1jMm+XZYRAmjnAJ44tsd9HP911WdQKLpgeKFlY1ESHgCfX19F walqkaEbywO7ZhK3fXIbkNo= =79Kx -----END PGP SIGNATURE----- --Sig_/b8ycDU4=DG=WkJhmifOR5S4--