From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by sourceware.org (Postfix) with ESMTPS id A7DDF3858C74; Wed, 21 Sep 2022 09:15:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A7DDF3858C74 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-x32c.google.com with SMTP id d12-20020a05600c3acc00b003b4c12e47f3so3351648wms.4; Wed, 21 Sep 2022 02:15:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date; bh=LCnIlNAK2cbxdD2485CNSqfB4O9CL/KEF5Y/ZtiditY=; b=B69sZwYoowr6IAgsVKjsWzO7B6Eg9pURALwcTU+gHGu76Vjq/kcC/H54qSCCiFqvJa s7V+Fni8e1BTfLXrC4ZAA8wZOiAv9/G4Sd+xFouhlxiBHNdY5Bo/4Bqop5NXpghP0jh6 Knfsai4z0BlCBlSqn2UuijlXOSIjz1KOdabvcFf4Dw7x/PPNsdupjRE3ZUPt5GxFS50p B8dK8BP4yUDNJf+RTjiJwybEPK+X1TCJ/5BJclJY/ZMiEW+LWSZ90pbMXF0OR3dM/+ha UHopXrC6IDV+m0byEMP7ja2DtS5HTb3dmZXwSjJSTwrasui4DR1LdOYgjJ77tLl67baY fIfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date; bh=LCnIlNAK2cbxdD2485CNSqfB4O9CL/KEF5Y/ZtiditY=; b=Ll9Jn0LtA+L518+vFiaXkVt7+r1WgzltKpiCrzRH58fDAkzjTgTKfWumY6/ux/Dpb6 EPbQTBajErw0YRLGEK+Z75bicFdwgKOedTyxyMaO3layo0bF5nopTDW8EbPuz7GQaFHi 8dqBRrOj0yKWBBCzaR5pFJ3hsawutlIZBTOwiHHqb5qLuvov6B9wjugS3eyQ6X4YQAhD ydxAPpXxdmR9RFz436xihvbh8QHA0Yia76XmzKw9Y0ItD4EJfoXKPU4qqoCFd2XZRn8T KlMYuf5yqAqmTEX5VQ/nlCD8fsvPELwTekJEk5OMhCT6CsEDf8l2RWQjhJLdGuppYi7N U5Qg== X-Gm-Message-State: ACrzQf1RDTDULQi9/dL9IA6cCTJZmjibJI6oIUBUN7YZjhfJFTO2ad5W mu2klXLS2esVAMDZ7dOmljACZDFeeOM= X-Google-Smtp-Source: AMsMyM6TfQibWVqbeXwEK32LV+/uZqu9Gotl0RdUDGYXOAZyQGN2jbD1V3c8jVqH5sk608MuBbKgew== X-Received: by 2002:a05:600c:1552:b0:3a8:4523:d16 with SMTP id f18-20020a05600c155200b003a845230d16mr5084418wmg.200.1663751737801; Wed, 21 Sep 2022 02:15:37 -0700 (PDT) Received: from smtpclient.apple ([2a01:e34:ec28:8cb0:bcdc:a622:ebbf:eb4f]) by smtp.gmail.com with ESMTPSA id r123-20020a1c2b81000000b003a62052053csm2681101wmr.18.2022.09.21.02.15.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Sep 2022 02:15:36 -0700 (PDT) From: FX Message-Id: <73BF06B8-3E5D-4D7F-9A51-7FE3120B9DC4@gmail.com> Content-Type: multipart/mixed; boundary="Apple-Mail=_9DBEBD4A-1592-4CD9-BBD2-4266538AF97E" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Subject: Re: [PATCH] Fortran 2018 rounding modes changes Date: Wed, 21 Sep 2022 11:15:35 +0200 In-Reply-To: <99C0538F-658C-4A7C-92B9-29E0C38A28CE@gmail.com> Cc: Mikael Morin , gcc-patches@gcc.gnu.org To: Fortran References: <52A7FAB8-735E-42D8-97A6-7E4C4F108C5E@gmail.com> <99C0538F-658C-4A7C-92B9-29E0C38A28CE@gmail.com> X-Mailer: Apple Mail (2.3696.120.41.1.1) X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: --Apple-Mail=_9DBEBD4A-1592-4CD9-BBD2-4266538AF97E Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Follow-up patch, including a test, committed as attached. FX --Apple-Mail=_9DBEBD4A-1592-4CD9-BBD2-4266538AF97E Content-Disposition: attachment; filename=0001-Fortran-handle-RADIX-kind-in-IEEE_SET_ROUNDING_MODE.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="0001-Fortran-handle-RADIX-kind-in-IEEE_SET_ROUNDING_MODE.patch" Content-Transfer-Encoding: quoted-printable =46rom=201aea1cb714f5a676901e702fc733595e0c9ad413=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Francois-Xavier=20Coudert=20= =0ADate:=20Wed,=2021=20Sep=202022=2011:06:19=20= +0200=0ASubject:=20[PATCH]=20Fortran:=20handle=20RADIX=20kind=20in=20= IEEE_SET_ROUNDING_MODE=0A=0AMake=20sure=20that=20calling=20= IEEE_SET_ROUNDING_MODE=20with=20RADIX=3D10=20does=20not=0Aaffect=20the=20= binary=20rounding=20mode.=0A=0A2022-09-21=20=20Francois-Xavier=20Coudert=20= =20=0A=0Alibgfortran/=0A=0A=09*=20= ieee/ieee_arithmetic.F90=20(IEEE_SET_ROUNDING_MODE):=20Handle=0A=09RADIX=20= argument=20better.=0A=0Agcc/testsuite/=0A=0A=09*=20= gfortran.dg/ieee/rounding_3.f90:=20New=20test.=0A---=0A=20= gcc/testsuite/gfortran.dg/ieee/rounding_3.f90=20|=2027=20= +++++++++++++++++++=0A=20libgfortran/ieee/ieee_arithmetic.F90=20=20=20=20= =20=20=20=20=20=20|=2012=20++++++---=0A=202=20files=20changed,=2036=20= insertions(+),=203=20deletions(-)=0A=20create=20mode=20100644=20= gcc/testsuite/gfortran.dg/ieee/rounding_3.f90=0A=0Adiff=20--git=20= a/gcc/testsuite/gfortran.dg/ieee/rounding_3.f90=20= b/gcc/testsuite/gfortran.dg/ieee/rounding_3.f90=0Anew=20file=20mode=20= 100644=0Aindex=2000000000000..ff4e834a042=0A---=20/dev/null=0A+++=20= b/gcc/testsuite/gfortran.dg/ieee/rounding_3.f90=0A@@=20-0,0=20+1,27=20@@=0A= +!=20{=20dg-do=20run=20}=0A+=0A+=20=20!=20Test=20IEEE_GET_ROUNDING_MODE=20= and=20IEEE_SET_ROUNDING_MODE=0A+=20=20!=20with=20a=20RADIX=20argument=0A= +=20=20use,=20intrinsic=20::=20ieee_arithmetic=0A+=20=20implicit=20none=0A= +=0A+=20=20real=20::=20sx1=0A+=20=20type(ieee_round_type)=20::=20r=0A+=0A= +=20=20if=20(ieee_support_rounding(ieee_up,=20sx1)=20.and.=20&=0A+=20=20=20= =20=20=20ieee_support_rounding(ieee_down,=20sx1))=20then=0A+=0A+=20=20=20= =20call=20ieee_set_rounding_mode(ieee_up)=0A+=20=20=20=20call=20= ieee_get_rounding_mode(r)=0A+=20=20=20=20if=20(r=20/=3D=20ieee_up)=20= stop=201=0A+=0A+=20=20=20=20call=20ieee_set_rounding_mode(ieee_down,=20= radix=3D2)=0A+=20=20=20=20call=20ieee_get_rounding_mode(r,=20radix=3D2)=0A= +=20=20=20=20if=20(r=20/=3D=20ieee_down)=20stop=202=0A+=0A+=20=20=20=20= call=20ieee_set_rounding_mode(ieee_up,=20radix=3D10)=0A+=20=20=20=20call=20= ieee_get_rounding_mode(r,=20radix=3D2)=0A+=20=20=20=20if=20(r=20/=3D=20= ieee_down)=20stop=203=0A+=20=20end=20if=0A+=0A+end=0Adiff=20--git=20= a/libgfortran/ieee/ieee_arithmetic.F90=20= b/libgfortran/ieee/ieee_arithmetic.F90=0Aindex=20= ce30e4afca3..4c8e3bb5e64=20100644=0A---=20= a/libgfortran/ieee/ieee_arithmetic.F90=0A+++=20= b/libgfortran/ieee/ieee_arithmetic.F90=0A@@=20-816,7=20+816,7=20@@=20= REM_MACRO(4,4,4)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20IEEE_SUPPORT_ROUNDING_NOARG=0A=20=20=20end=20interface=0A=20=20= =20public=20::=20IEEE_SUPPORT_ROUNDING=0A-=20=20=0A+=0A=20=20=20!=20= Interface=20to=20the=20FPU-specific=20function=0A=20=20=20interface=0A=20= =20=20=20=20pure=20integer=20function=20support_rounding_helper(flag)=20= &=0A@@=20-839,7=20+839,7=20@@=20REM_MACRO(4,4,4)=0A=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20= IEEE_SUPPORT_UNDERFLOW_CONTROL_NOARG=0A=20=20=20end=20interface=0A=20=20=20= public=20::=20IEEE_SUPPORT_UNDERFLOW_CONTROL=0A-=20=20=0A+=0A=20=20=20!=20= Interface=20to=20the=20FPU-specific=20function=0A=20=20=20interface=0A=20= =20=20=20=20pure=20integer=20function=20= support_underflow_control_helper(kind)=20&=0A@@=20-1074,7=20+1074,13=20= @@=20contains=0A=20=20=20=20=20=20=20=20=20integer,=20value=20::=20val=0A= =20=20=20=20=20=20=20end=20subroutine=0A=20=20=20=20=20end=20interface=0A= -=20=20=20=20=0A+=0A+=20=20=20=20!=20We=20do=20not=20support=20RADIX=20=3D= =2010,=20and=20such=20calls=20should=20not=0A+=20=20=20=20!=20modify=20= the=20binary=20rounding=20mode.=0A+=20=20=20=20if=20(present(RADIX))=20= then=0A+=20=20=20=20=20=20if=20(RADIX=20=3D=3D=2010)=20return=0A+=20=20=20= =20end=20if=0A+=0A=20=20=20=20=20call=20helper(ROUND_VALUE%hidden)=0A=20=20= =20end=20subroutine=0A=20=0A--=20=0A2.25.1=0A=0A= --Apple-Mail=_9DBEBD4A-1592-4CD9-BBD2-4266538AF97E--