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=-2.9 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, 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 1A8322DA65 for ; Wed, 28 Aug 2024 17:29:00 +0200 (CEST) Received: (qmail 16198 invoked by uid 550); 28 Aug 2024 15:28:56 -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 16163 invoked from network); 28 Aug 2024 15:28:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alexrp.com; s=alexrp; t=1724858927; x=1725463727; darn=lists.openwall.com; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=52+uc4O10KgBa4L1vj+EpXNsq0i4OhiYjIeb26+sq5U=; b=QmzdZKjgmVpZ7Gcfm+W2UtqKp63CeUAye+sMZHyoLL5UFTpHO3DDIomgsLHYRy/mPT nMfz45Y6W7fpmB9DDkZR2Y9cEkClB2LG1wOnP03bW26hLuyyWAAnGvxjEYU6qWfRoIu9 BuLWW2Xg4viy/hIyLwfaUdOpgJ3puc5ayhDiZcziyYqV6ib8q3XfsGQuVHIeB0HexKRN G+XQmtG4jaHQVi5D5neQRPtXPGg6IdPpSjqMrFzlP5jRitQ+gbdXihmYFsq1wqA8jP4N ZKAkDQp1A7fyvDa8VA9G7/9sLjB/Mir8OssTzBUOxXWY4IFitjZxlfJmA3nDASyrQyKt WSfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724858927; x=1725463727; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=52+uc4O10KgBa4L1vj+EpXNsq0i4OhiYjIeb26+sq5U=; b=jme+6Su8ojD2R2lpGc5lhlcG7gbkyzJI9QonNVZ0CcvTABW4x7ssSX2Vqrdnh41f/h 9eJ4Gxaj/fVPzoAXS0tzk+P8vA4fDMnj+TlILe8wITChdfUshW84EAeehNQe367E8kUi tGjk5oUjZHy37HnuB8WPL3AIyY8oO5D6AG4H3Z0hHNGeKYzbJI/cV96DgwBzXpoIVO+J o1WimRy9/pqqo0vWwhZhgzd8DH3O2epiAtjNyZ7c/zA+0R7mb/Btq+1zL3O+Xw7uvlQw QnDXlhBVoGplRMJoee6glXXXbANz3zRIp6JOStu0PE9ax31qFc3Qu6Svsobc/osIIqk7 oO3A== X-Gm-Message-State: AOJu0YxjSGJJB4dSMz8+ZEF/1ptnMkDOdttkibGB8dS3LBQmIMmYxtco +FErzZmrLSny9KiTRkmlB3xydzbd9Jxeiiz761ZKnSxy4VQqTs569m/2N5CO69csaqHhfKgK0XS tMyP0DW6RCAf7PqNlLfrPWzdDGyyveennCSG72v+nAFFVDCHEYo+DrFENVDO4skc8EpmuZGhRzw 8DKNaW/m+coQBpNw9qhR1qNvbRVHLcfGH1 X-Google-Smtp-Source: AGHT+IFozd7zka3XBlyfD/Vrd4V18L2uMpvHtlYQRlZlKukDwIgWrpaEcym1LPoL5A8XyGmR86tNog== X-Received: by 2002:a17:907:80c:b0:a86:96da:afb with SMTP id a640c23a62f3a-a870a9a02cemr316203766b.10.1724858926640; Wed, 28 Aug 2024 08:28:46 -0700 (PDT) From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= To: musl@lists.openwall.com Cc: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= Date: Wed, 28 Aug 2024 17:28:26 +0200 Message-Id: <20240828152826.826990-1-alex@alexrp.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [musl] [PATCH] configure: prevent compilers from turning a * b + c into fma(a, b, c) 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. Work around this by passing -ffp-contract=off for Clang and -mno-fused-madd for GCC. This matches what glibc's configure.ac does, FWIW. --- configure | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/configure b/configure index bc9fbe48..7028793f 100755 --- a/configure +++ b/configure @@ -355,6 +355,15 @@ tryflag CFLAGS_C99FSE -fexcess-precision=standard \ || { test "$ARCH" = i386 && tryflag CFLAGS_C99FSE -ffloat-store ; } tryflag CFLAGS_C99FSE -frounding-math +# +# Prevent the compiler from turning a * b + c into an fma() call. +# Clang at least has been known to do this in the implementation of +# fma() itself when targeting arm-linux-musleabi and armv8-a, causing +# infinite recursion. +# +tryflag CFLAGS_C99FSE -mno-fused-madd +tryflag CFLAGS_C99FSE -ffp-contract=off + # # Semantically we want to insist that our sources follow the # C rules for type-based aliasing, but most if not all real-world -- 2.40.1