From owner-freebsd-current@freebsd.org Sat Sep 26 19:55:37 2020 Return-Path: Delivered-To: freebsd-current@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DC6BD42773D for ; Sat, 26 Sep 2020 19:55:37 +0000 (UTC) (envelope-from zarychtam@plan-b.pwste.edu.pl) Received: from plan-b.pwste.edu.pl (plan-b.pwste.edu.pl [IPv6:2001:678:618::40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "plan-b.pwste.edu.pl", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BzKJn32c4z42Cf; Sat, 26 Sep 2020 19:55:37 +0000 (UTC) (envelope-from zarychtam@plan-b.pwste.edu.pl) Received: from plan-b.pwste.edu.pl (zarychtam@localhost [127.0.0.1]) by plan-b.pwste.edu.pl (8.16.1/8.16.1) with ESMTPS id 08QJtXcs019129 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 26 Sep 2020 21:55:33 +0200 (CEST) (envelope-from zarychtam@plan-b.pwste.edu.pl) Received: (from zarychtam@localhost) by plan-b.pwste.edu.pl (8.16.1/8.16.1/Submit) id 08QJtX4N019128; Sat, 26 Sep 2020 21:55:33 +0200 (CEST) (envelope-from zarychtam) Date: Sat, 26 Sep 2020 21:55:33 +0200 From: Marek Zarychta To: Dimitry Andric Cc: freebsd-current@freebsd.org Subject: Re: clang build buggy code with certain CPUTYPE setting Message-ID: <20200926195533.GA16596@plan-b.pwste.edu.pl> References: <20200926114045.GA31128@plan-b.pwste.edu.pl> <6AA016B6-EEAC-4580-B7F0-9D274ADA9E73@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="2oS5YaxWCcQjTEyO" Content-Disposition: inline In-Reply-To: <6AA016B6-EEAC-4580-B7F0-9D274ADA9E73@FreeBSD.org> X-Rspamd-Queue-Id: 4BzKJn32c4z42Cf X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:206006, ipnet:2001:678:618::/48, country:PL] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Sep 2020 19:55:37 -0000 --2oS5YaxWCcQjTEyO Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Sep 26, 2020 at 05:48:33PM +0200, Dimitry Andric wrote: > On 26 Sep 2020, at 13:40, Marek Zarychta = wrote: > >=20 > > I have done a few builds of CURRENT in a row one or two weeks apart. The > > builds with CPUTYPE?=3Damdfam10 set produce buggy code, for example whi= le > > running mergemaster I get this error: > >=20 > > PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and > > include the crash backtrace, preprocessed source, and associated run > > script. > > Stack dump: > > 0. Program arguments: cc --version > > #0 0x00000000040ede6e (/usr/bin/cc+0x40ede6e) > > #1 0x00000000040ec0e5 (/usr/bin/cc+0x40ec0e5) > > #2 0x00000000040ee550 (/usr/bin/cc+0x40ee550) > > #3 0x000000080553babe (/lib/libthr.so.3+0x19abe) > > Illegal instruction > > make: "/usr/src/share/mk/bsd.compiler.mk" line 181: Unable to determine > > compiler type for CC=3Dcc. Consider setting COMPILER_TYPE. > >=20 > > The 13-CURRENT world built without CPUTYPE runs fine, the same for > > recent 12.2-STABLE world build with CPUTYPE?=3Damdfam10 on the same > > machine. >=20 > Hi Marek, >=20 > In r365507 (on 2020-09-09) I committed a fix for amdfam10: >=20 > ------------------------------------------------------------------------ > r365507 | dim | 2020-09-09 20:11:04 +0200 (Wed, 09 Sep 2020) | 17 lines >=20 > Merge commit e6bb4c8e7 from llvm git (by Craig Topper): >=20 > [X86] SSE4_A should only imply SSE3 not SSSE3 in the frontend. >=20 > SSE4_1 and SSE4_2 due imply SSSE3. So I guess I got confused when > switching the code to being table based in D83273. >=20 > Fixes PR47464 >=20 > This should fix builds with -march=3Damdfam10 emitting SSSE3 instructions > such as pshufb, which lead to programs crashing with SIGILL on such > processors. >=20 > Reported by: avg > MFC after: 6 weeks > X-MFC-With: r364284 >=20 > So I expect that the "Illegal instruction" you are seeing is an SSSE3 > instruction. If this happens with your base compiler, please get a > known-good copy from one of the snapshot images. Ensure your /usr/src is > r365507 or later, then do a full buildworld and reinstall. >=20 > -Dimitry >=20 Dear Dimitry, Thank you for the information and for the fix. Sadly I must admit it doesn't work for me. I have tried two builds with fresh sources today to be certain and it looks like the bug is still present on FreeBSD 13-CURRENT r366186. Either the upstream fixed it only partially or it is another bug. As a workaround, I will build worlds without CPUTYPE?=3Damdfam10 for a while. I hope the problem will be resolved before clang 11 is MFCed to 12-STABLE. --=20 Marek Zarychta --2oS5YaxWCcQjTEyO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEMOqvKm6wKvS1/ZeCdZ/s//1SjSwFAl9vnLIACgkQdZ/s//1S jSxqlwf/fKaRVWpTLv5YT2Eyfnybt25U/SEwSpq33UQv+ItZyG34tcl/G/euoSWv Ot9tFMnAHXS0CziyOVMyIS/70HnAgnZNlpRUuQI1eVOGLTcgwoH0wQ/QlFFTBssw XlcohMfjnZI+bHspY/iu9BfjMQTl500Bap1TAvaDbNEnTw/xurxiZkQScGkmf7Vi KENrPmeLzU58z7k2xmQpZA1YpDNu4Yz2QNcSIq0WGFSf/BHHev8L2gNfUpoAc3qM /RAFZmTc4sQ6Ghp9NpZy+iwL+4cAu1FVNBFAwotAi4M0uPRCRguMIrDi9EtUtYKf 0a5q2tF0kSuKEYoJO9t1kNTthqN/LA== =feP7 -----END PGP SIGNATURE----- --2oS5YaxWCcQjTEyO--