From owner-freebsd-current@freebsd.org Tue Sep 8 21:15:53 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 10B293D83D6; Tue, 8 Sep 2020 21:15:53 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (troutmask.apl.washington.edu [128.95.76.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "troutmask", Issuer "troutmask" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BmHxh11VJz4T45; Tue, 8 Sep 2020 21:15:51 +0000 (UTC) (envelope-from sgk@troutmask.apl.washington.edu) Received: from troutmask.apl.washington.edu (localhost [127.0.0.1]) by troutmask.apl.washington.edu (8.16.1/8.16.1) with ESMTPS id 088LFn9b084513 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 8 Sep 2020 14:15:49 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.16.1/8.16.1/Submit) id 088LFntL084512; Tue, 8 Sep 2020 14:15:49 -0700 (PDT) (envelope-from sgk) Date: Tue, 8 Sep 2020 14:15:49 -0700 From: Steve Kargl To: Dimitry Andric Cc: freebsd-toolchain@freebsd.org, freebsd-current@freebsd.org Subject: Re: clang miscompiles OpenLibm on i686-*-freebsd Message-ID: <20200908211549.GA84481@troutmask.apl.washington.edu> References: <20200908021002.GA76325@troutmask.apl.washington.edu> <20200908025513.GA76566@troutmask.apl.washington.edu> <20200908174721.GA81469@troutmask.apl.washington.edu> <66AE2F5B-F150-4D52-BF43-8F453217FC33@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <66AE2F5B-F150-4D52-BF43-8F453217FC33@FreeBSD.org> X-Rspamd-Queue-Id: 4BmHxh11VJz4T45 X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:73, ipnet:128.95.0.0/16, country:US] 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: Tue, 08 Sep 2020 21:15:53 -0000 On Tue, Sep 08, 2020 at 09:11:50PM +0200, Dimitry Andric wrote: > On 8 Sep 2020, at 19:47, Steve Kargl wrote: > > > > I think I've found the problem, and it appears to be > > due to a change byt Openlibm developers to the file > > math_private.h copied from FreeBSD. Namely, one finds > > > > //VBS > > #define STRICT_ASSIGN(type, lval, rval) ((lval) = (rval)) > > > > /* VBS > > #ifdef FLT_EVAL_METHOD > > // Attempt to get strict C99 semantics for assignment with non-C99 compilers. > > #if FLT_EVAL_METHOD == 0 || __GNUC__ == 0 > > #define STRICT_ASSIGN(type, lval, rval) ((lval) = (rval)) > > #else > > #define STRICT_ASSIGN(type, lval, rval) do { \ > > volatile type __lval; \ > > \ > > if (sizeof(type) >= sizeof(double)) \ > > (lval) = (rval); \ > > else { \ > > __lval = (rval); \ > > (lval) = __lval; \ > > } \ > > } while (0) > > #endif > > #endif > > */ > > > > So, STRICT_ASSIGN is broken in Openlibm. I'll be reporting > > a bug upstream. Apoogies for the noise. > > Hi Steve, > > I'm curious what their rationale was, as the commit that changed it is: > > https://github.com/JuliaMath/openlibm/commit/f5fb92746715beb0441a60feca202ee16cb19fc9 > > with a description of just "Build with gcc"... Maybe they've assumed gcc > never needs the volatile approach? > I have no idea why OpenLibm would change math_private.h. I've reported the issue at https://github.com/JuliaMath/openlibm/issues/215 -- Steve