Date: Thu, 8 Dec 2011 13:48:04 -0500 From: Alexander Kabaev <kabaev@gmail.com> To: Gleb Kurtsou <gleb.kurtsou@gmail.com> Cc: freebsd-hackers@FreeBSD.org Subject: Re: gcc 4.2 miscompilation with -O2 -fno-omit-frame-pointer on amd64 Message-ID: <20111208134804.125d45a9@kan.dyndns.org> In-Reply-To: <20111119100150.GA1560@reks> References: <20111119100150.GA1560@reks>
next in thread | previous in thread | raw e-mail | index | archive | help
--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 <gleb.kurtsou@gmail.com> 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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111208134804.125d45a9>