From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by inbox.vuxu.org (Postfix) with SMTP id 4033C2D044 for ; Wed, 28 Aug 2024 17:53:43 +0200 (CEST) Received: (qmail 32468 invoked by uid 550); 28 Aug 2024 15:53:39 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 32432 invoked from network); 28 Aug 2024 15:53:39 -0000 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 95E7540B27B0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1724860410; bh=iuu0rJDhuh6MmAPtLddHSHaIBsz2FALN2YGCM/Fd078=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=CGgUprzKnXT+9l+EVLTfqhPSbcqQcn39Zv553Rz/dDUCkXBs55dHQyOIgq6mOKpRh qTz+UuSLIi9RJQGe/mj97NXf1fXipTI6qLekGz77xMoWwsww5FSHcT9R3nygmTBh+u GCbNLIzoaqFlYBdIwV46+pfOZgNv+RQ/hE7f4OHQ= Date: Wed, 28 Aug 2024 18:53:30 +0300 (MSK) From: Alexander Monakov To: musl@lists.openwall.com cc: =?ISO-8859-15?Q?Alex_R=F8nne_Petersen?= In-Reply-To: <20240828152826.826990-1-alex@alexrp.com> Message-ID: References: <20240828152826.826990-1-alex@alexrp.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323328-657422116-1724860410=:19706" Subject: Re: [musl] [PATCH] configure: prevent compilers from turning a * b + c into fma(a, b, c) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-657422116-1724860410=:19706 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8BIT On Wed, 28 Aug 2024, Alex Rønne Petersen wrote: > I've seen Clang do this for expressions in the fma() implementation itself, > which of course led to infinite recursion. This happened when targeting > arm-linux-musleabi with full soft float mode and -march=armv8-a. I imagine > it's possible for GCC to do similar silliness. musl passes -std=c99 to the compiler, and in all GCC releases so far* that disables FMA contraction (as opposed to -std=gnu99 or whichever -std=gnuXX is enabled by default, where unrestricted contraction is implicitly enabled, i.e. the non-standard and dangerous -ffp-contract=fast mode). Clang respects #pragma STDC FP_CONTRACT OFF, so that is available as a smaller hammer than disabling fma across the board. Breaking up contractable expression in fma*.c will work too. [*] maybe modulo bugs in old releases where the backend doesn't respect -ffp-contract=off and which Glibc worked around with -mno-fused-madd. Alexander --8323328-657422116-1724860410=:19706--