From patchwork Tue Jul 7 14:40:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Piotr Kubaj X-Patchwork-Id: 138664 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A29084BA23D9 for ; Tue, 7 Jul 2026 14:44:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A29084BA23D9 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail.anongoth.pl (mail.anongoth.pl [46.248.190.61]) by sourceware.org (Postfix) with ESMTPS id E3FD74BA23F4; Tue, 7 Jul 2026 14:41:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E3FD74BA23F4 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=anongoth.pl ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E3FD74BA23F4 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=46.248.190.61 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435302; cv=none; b=kW2VayT0KeGXeggU4xVw2evOvGWKRcXel+CpM9CNrQdKTR3cmaeilFjv3whFS1e9J8Lien9OI7kr4AjIYCtEtoRH3oSgnwtaTWoxgnKVzr/k2BxIFbr6wTxI1IQKyfzkXg7Vj/PwfQm/L4pcwWUobhBp6DaXxnKbGLfZgUY3Tc8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783435302; c=relaxed/simple; bh=uTk1S67fCFQuO8QEdlxjQPHSJDVXWSazLY9OLH7dreU=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=DN7qahfFvQFzDgtiNFFkkb8qrEvvO+/IZEE6JDkQpM3peZEl7PujBxhxq/BqVBBa30u4sI/HWqnZIev8p6VEgkZCxm/JE43L5TOqBTgqa54RxR89HUZFvSxYdAZOfssPIu8AkiI0wqkFk/8HmPb7dq11yv4yGwv45GhmOsOEdeQ= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E3FD74BA23F4 Received: by mail.anongoth.pl (Postfix) id 8FD3D18E83; Tue, 07 Jul 2026 16:41:40 +0200 (CEST) Authentication-Results: mail.anongoth.pl; dmarc=fail (p=none dis=none) header.from=FreeBSD.org From: Piotr Kubaj To: gcc-patches@gcc.gnu.org Cc: fortran@gcc.gnu.org, Segher Boessenkool , "Kewen . Lin" , Peter Bergner , Piotr Kubaj Subject: [PATCH 6/7] fortran: only apply the IEEE-128 long double kind remap with glibc Date: Tue, 7 Jul 2026 16:40:08 +0200 Message-ID: <20260707144106.10130-7-pkubaj@FreeBSD.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260707144106.10130-1-pkubaj@FreeBSD.org> References: <20260707144106.10130-1-pkubaj@FreeBSD.org> MIME-Version: 1.0 X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, LOCAL_AUTHENTICATION_FAIL_DMARC, SPF_HELO_NONE, SPF_PASS, TXREP shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org gfc_init_kinds detects the powerpc64le -mabi=ieeelongdouble case and, for libgfortran, gives REAL(KIND=16) the ABI of KIND=17 and routes its runtime math through the glibc *ieee128 / libquadmath entry points. That machinery is glibc-specific (it is keyed on TARGET_GLIBC_MAJOR/MINOR); on a non-glibc target such as FreeBSD it makes libgfortran reference names that do not exist (__*ieee128, and libquadmath *q such as iroundq). Restrict the block to glibc (TARGET_GLIBC_MAJOR >= 2). On FreeBSD long double is native IEEE-128, so REAL(KIND=16) keeps its natural kind-16 ABI and its math resolves to the plain *l libm entry points. gcc/fortran/ChangeLog: * trans-types.cc (gfc_init_kinds): Only apply the -mabi=ieeelongdouble kind remapping on glibc. Signed-off-by: Piotr Kubaj --- gcc/fortran/trans-types.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/fortran/trans-types.cc b/gcc/fortran/trans-types.cc --- a/gcc/fortran/trans-types.cc +++ b/gcc/fortran/trans-types.cc @@ -513,7 +513,8 @@ precision. For libgfortran calls pretend the IEEE 754 quad TFmode has kind 17 rather than 16 and use kind 16 for the IBM extended format TFmode. */ - if (composite_mode != QImode && saw_r16 && !MODE_COMPOSITE_P (r16_mode)) + if (composite_mode != QImode && saw_r16 && !MODE_COMPOSITE_P (r16_mode) + && TARGET_GLIBC_MAJOR >= 2) { for (int i = 0; i < r_index; ++i) if (gfc_real_kinds[i].kind == 16)