From patchwork Tue Oct 8 00:38:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 1173032 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-510436-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="WEepOy93"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46nJP44m94z9s4Y for ; Tue, 8 Oct 2019 11:38:30 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=Q45OveVsMo1LBI32EWaI1HWA71oaA/7642tq6+vx8+ZGjwcevf9Y5 iplDlepLBsDCoqNQVAMGypjvWLytB0pkHI0w9goA1n2PbEvHXrevcuroBHasMBjP SSXEQh7zGArjHLsg5YLc6TjB5fWb4cGPBMdP6xIG2u9u/yQBf6WJc8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=FMPA/hzOKXMnNNd+2Uij0WIafgk=; b=WEepOy93cpUtmYnGh7sS Zz1sH0PKs7Gl5S4PzEdNNzDwVglz8cnSO3hhjWL+qOowd8jZ2TGUeOFfHSsuQvhP wBaMyxJmf06HWWrH5g/YXkHfz/xxpappUgQJ6CmOhzb8C+8qPiEhZNECVCcd6Tc9 L1h4L4r/j9VIQkpAiKi77Yg= Received: (qmail 38113 invoked by alias); 8 Oct 2019 00:38:22 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 38100 invoked by uid 89); 8 Oct 2019 00:38:22 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, SPF_PASS autolearn=ham version=3.3.1 spammy=Applied, c2x X-HELO: esa2.mentor.iphmx.com Received: from esa2.mentor.iphmx.com (HELO esa2.mentor.iphmx.com) (68.232.141.98) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 08 Oct 2019 00:38:21 +0000 IronPort-SDR: /+VB4/6EezeIWtOCahePaoZmqa8C5hryEMdEqH1ENQsniyyPXyeNS/fOwk4nya0AUlaq/IIKCE /uvamwkAPiKPWExjwIcFBEdQq7SsNrDewkK9sqSWfe4wV0xDKnt2o1j4IxmPhTmluilAN1rDpj fwNhq+BkgwbqwDgEO9RsBuGtqc/s9TG3xqHbmn6SkeheRrp3Ad6awkd7X2lGxTznR3GCNXfWxT jQUuB6AF+9uRyvqk6VAiN2ZpZ59BU91e3I4ORjRAj9lhWCi9JUbCvgbh2erkJh+S0KKRAulDmj BCw= Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165]) by esa2.mentor.iphmx.com with ESMTP; 07 Oct 2019 16:38:19 -0800 IronPort-SDR: lB5fq2kg/8J8kXrvhEMnUjHkWXlXHL8Ts//XLMqtxEUZ1wLUmPFVY+vikMPpHDry+ofCTjVjpq SjIsB1efWPyKffgOrtaTzySf7J+h1R0xFT/9RElrjNkJ6vfECR1PThZJLnZvQBDnI4l8H/+Xth x5nvi/Sm+Ti95T+Ry7skPIlywY8hFJ1hntdizhad+woxiYDYNII1qyOg9IYJAPuHBWZyzYA4qr oZUcXy06rxMJUG0dcmvipT9YRmtSiS0l75oqQU+hP9m3LNswlsVdlLKaSFh+A2SwPEKdTZW5p0 veA= Date: Tue, 8 Oct 2019 00:38:14 +0000 From: Joseph Myers To: Subject: Make C2X imply -fno-fp-int-builtin-inexact Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Since TS 18661-1 has been integrated into C2X, this patch makes C2X imply -fno-fp-int-builtin-inexact. Bootstrapped with no regressions on x86_64-pc-linux-gnu. Applied to mainline. gcc: 2019-10-08 Joseph Myers * doc/invoke.texi (-ffp-int-builtin-inexact): Document -fno-fp-int-builtin-inexact default for C2X. gcc/c-family: 2019-10-08 Joseph Myers * c-opts.c (c_common_post_options): Set -fno-fp-int-builtin-inexact for C2X. gcc/testsuite: 2019-10-08 Joseph Myers * gcc.dg/torture/builtin-fp-int-inexact-c2x.c: New test. Index: gcc/c-family/c-opts.c =================================================================== --- gcc/c-family/c-opts.c (revision 276655) +++ gcc/c-family/c-opts.c (working copy) @@ -826,6 +826,12 @@ c_common_post_options (const char **pfilename) else flag_permitted_flt_eval_methods = PERMITTED_FLT_EVAL_METHODS_C11; + /* C2X Annex F does not permit certain built-in functions to raise + "inexact". */ + if (flag_isoc2x + && !global_options_set.x_flag_fp_int_builtin_inexact) + flag_fp_int_builtin_inexact = 0; + /* By default we use C99 inline semantics in GNU99 or C99 mode. C99 inline semantics are not supported in GNU89 or C89 mode. */ if (flag_gnu89_inline == -1) Index: gcc/doc/invoke.texi =================================================================== --- gcc/doc/invoke.texi (revision 276655) +++ gcc/doc/invoke.texi (working copy) @@ -10810,12 +10810,12 @@ Do not allow the built-in functions @code{ceil}, @ double} variants, to generate code that raises the ``inexact'' floating-point exception for noninteger arguments. ISO C99 and C11 allow these functions to raise the ``inexact'' exception, but ISO/IEC -TS 18661-1:2014, the C bindings to IEEE 754-2008, does not allow these -functions to do so. +TS 18661-1:2014, the C bindings to IEEE 754-2008, as integrated into +ISO C2X, does not allow these functions to do so. The default is @option{-ffp-int-builtin-inexact}, allowing the -exception to be raised. This option does nothing unless -@option{-ftrapping-math} is in effect. +exception to be raised, unless C2X or a later C standard is selected. +This option does nothing unless @option{-ftrapping-math} is in effect. Even if @option{-fno-fp-int-builtin-inexact} is used, if the functions generate a call to a library function then the ``inexact'' exception Index: gcc/testsuite/gcc.dg/torture/builtin-fp-int-inexact-c2x.c =================================================================== --- gcc/testsuite/gcc.dg/torture/builtin-fp-int-inexact-c2x.c (nonexistent) +++ gcc/testsuite/gcc.dg/torture/builtin-fp-int-inexact-c2x.c (working copy) @@ -0,0 +1,7 @@ +/* Test C2X enables -fno-fp-int-builtin-inexact. */ +/* { dg-do run } */ +/* { dg-options "-std=c2x" } */ +/* { dg-add-options c99_runtime } */ +/* { dg-require-effective-target fenv_exceptions } */ + +#include "builtin-fp-int-inexact.c"