From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 37998385041C for ; Mon, 8 Mar 2021 16:26:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 37998385041C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=botcazou@adacore.com Received: by mail-wm1-x335.google.com with SMTP id u5-20020a7bcb050000b029010e9316b9d5so1220687wmj.2 for ; Mon, 08 Mar 2021 08:26:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TU/kIyTPDXKhdb935M8N1oDli6Edc1RsJdIAA8pguTc=; b=0XwsdCHFGNOmFIF81Pm/kceSbLs51HSjYCzacjJ0KB1qfBKKD7JDiVn+ZvDCbKcV1c VtNjiCEwUNX+JHNKeZG6lSrl9v3+faMHWwCxZ18k2z5D/dYKkr4TKENhe7lK9k3qsUSS fpV0+pbuRJ60vJFMHxZzPVH25s4v01+sm8hwAKTNoPkaG1FUi23AUq3tgblvLQF2g3Yv v1bu7NGt15lpULHU9bDD5kMXOKpCsSlY601Vi5L6K2/HJMfeum5lxlbIeIW+t4fFyQ9N kYsVIQY1iy4R9jdCn8Sxs5fyt3Q6I6carV7vd+TtL9w98zL2nPbAKREBiNtVI/hgIW8n /9OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=TU/kIyTPDXKhdb935M8N1oDli6Edc1RsJdIAA8pguTc=; b=odVUxT7T5821ES/vKBGp89X50bD0DeqgxJUk3FwfTtsyjEOjgjaQ9RWRsv7cig3by5 TZYL1qItK3jvauzyOYS/Zb/hri3ADqAmpqEyeCKQx0j7+JWBgGyq9VGtrKla9W1K4Dt3 6YyI7LaVgQGY60orvcUdQD1r8l2urN+z8mbnO21FaBJ4qMhV1N2dMtp3dJw7rnMyIbiX /bbZmbmiTcpojAUsw5ndxFrhDy3z0oIiRlHfKJiUZ2X/QIgrFkRCxcWx8HVVYgR49Khr 0pyeGM556iLDDWPnKSDGdxF1jbvnkXtOwyqg6EVlXuO8OCZKg4UGmg540GJChiLNuayJ o6Fw== X-Gm-Message-State: AOAM530tLGROTscWnkNVS2wgo9Xal4kjdpEyMISVanAvifgG+OcJneHF 33lHqFFw8PR8XRLTOjIeAdMfXasBXgz0ckgV X-Google-Smtp-Source: ABdhPJwno4B6HI/z3kEBIqIKRcY+fToX97T2XCDs729Wa5yeRTE2GAjsQQTRdPDNydiLlnEYEes6yw== X-Received: by 2002:a1c:6a12:: with SMTP id f18mr23435618wmc.31.1615220766268; Mon, 08 Mar 2021 08:26:06 -0800 (PST) Received: from fomalhaut.localnet ([2a01:e0a:41b:84f0:cf71:f5e0:b050:bede]) by smtp.gmail.com with ESMTPSA id b131sm19822358wmb.34.2021.03.08.08.26.05 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 08 Mar 2021 08:26:05 -0800 (PST) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: fortran Cc: gcc-patches Subject: [patch] Fix PR fortran/96983 Date: Mon, 08 Mar 2021 17:25:36 +0100 Message-ID: <5050796.fM2REodTD2@fomalhaut> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart1692793.s37qnjzUMg" Content-Transfer-Encoding: 7Bit X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 16:26:08 -0000 This is a multi-part message in MIME format. --nextPart1692793.s37qnjzUMg Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Hi, AFAICS the code in build_round_expr implicitly assumes that __float128 exists, which is *not* the common case among 64-bit architectures since "long double" is generally already 128-bit for them. Tested on x86-64/Linux and SPARC64/Linux, OK for the mainline? 2021-03-08 Eric Botcazou PR fortran/96983 * trans-intrinsic.c (build_round_expr): Do not implicitly assume that __float128 is the 128-bit floating-point type. -- Eric Botcazou --nextPart1692793.s37qnjzUMg Content-Disposition: attachment; filename="pr96983.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="utf-8"; name="pr96983.diff" diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 5c9258c65c3..ae359a07973 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -407,7 +407,10 @@ build_round_expr (tree arg, tree restype) if (kind < 0) gfc_internal_error ("Could not find real kind with at least %d bits", resprec); - arg = fold_convert (gfc_float128_type_node, arg); + if (gfc_real16_is_float128) + arg = fold_convert (gfc_float128_type_node, arg); + else + arg = fold_convert (long_double_type_node, arg); fn = gfc_builtin_decl_for_float_kind (BUILT_IN_ROUND, kind); } else --nextPart1692793.s37qnjzUMg--