Re: [PATCH] libquadmath: add quad support for trig-pi functions
On Thu, Jul 03, 2025 at 12:56:24AM +0800, Yuao Ma wrote: > > This patch adds the required function for Fortran trigonometric functions to > work with glibc versions prior to 2.26. It's based on glibc source commit > 632d895f3e5d98162f77b9c3c1da4ec19968b671. > > I've built it successfully on my end. Documentation is also included. > > Please take a look when you have a moment. > ... > * math/acospiq.c: New file. > * math/cospiq.c: New file. I have only at these 2 functions and only quickly as I cannot read (L)GPL for implementation of special function for fear of taint. Have you done any benchmarks with respect to numerical accuracy? I suspect these functions have unnecessary issues with precision. -- steve
Re: [Fortran, Patch, PR120843, v3] Fix reject valid, because of inconformable coranks
On 7/2/25 9:40 AM, Jerry D wrote: On 7/2/25 3:14 AM, Andre Vehreschild wrote: Hi all, I successfully created a big mess with the previous patch. First of all by applying an outdated one and secondly by adding the conformance checks for coranks in a3f1cdd8ed46f9816b31ab162ae4dac547d34ebc. Checking the standard even using AI (haha) to figure if coranks of an expression have restrictions on them, failed. I found nothing. AI fantasized about restrictions that did not exist. Therefore the current approach is to remove the conformance check and just use the computed coranks in expressions to prevent recomputaion whenever they needed. Jerry, Harald: Sorry for all the bother and all my mistakes. I am really sorry to have wasted your time. The patch has been regtested fine on x86_64-pc-linux-gnu / F41. Ok for mainline and later backport to gcc-15? Regards, Andre --- snip --- With this fixer patch, I can successfully compile Toon's test case. The patch also regression tests here OK. OK to push. Jerry As a followup, with the fixer patch applied, OpenCoarrays builds. However, make test hangs at Test 4. 3/88 Test #3: register_vector ... Passed0.42 sec Start 4: register_alloc_vector ^Cmake[3]: *** [CMakeFiles/check.dir/build.make:70: CMakeFiles/check] Interrupt make[2]: *** [CMakeFiles/Makefile2:962: CMakeFiles/check.dir/all] Interrupt make[1]: *** [CMakeFiles/Makefile2:969: CMakeFiles/check.dir/rule] Interrupt make: *** [Makefile:205: check] Interrupt I waited about 20 minutes. This may be another bug. I built and tested OpenCorrays about 2 days ago with gfortran 14 with no problems. I am able to compile and run Toon's test case with this OpenCoarrays. So we still have some breakage on 15 and 16 remaining. I have not tried building OpenCoarrays with the shmem patch applied yet. This will be my next step here. Regards, Jerry
Re: [Fortran, Patch, PR120843, v3] Fix reject valid, because of inconformable coranks
On 7/2/25 9:02 AM, Steve Kargl wrote: On Wed, Jul 02, 2025 at 04:36:38AM -0700, Damian Rouson wrote: git branch gir checkout git add git commit git rebase git push The above IS the process everyone uses on gcc. The email is only a "pull request" for reviewing the patches. It works quite well. Once it is reviewed/approved, the requester does the last step which is the push. For this particular patch, 'save as' the file, "patch -p1 It’s time to move beyond emailing patches! (Please.) There are others on the gcc team evaluating a platform, not GitHub, which will likely be integrated to generate an email review/approve request. It is unlikely the email will go away. I would expect multiple means of doing a "pull request". I don't use git other than 'git clone', 'git reset --hard', and 'git diff'. If gfortran development goes this route, I am done. -- steve Cheers, Jerry
Re: [Fortran, Patch, PR120843, v3] Fix reject valid, because of inconformable coranks
On 7/2/25 3:14 AM, Andre Vehreschild wrote: Hi all, I successfully created a big mess with the previous patch. First of all by applying an outdated one and secondly by adding the conformance checks for coranks in a3f1cdd8ed46f9816b31ab162ae4dac547d34ebc. Checking the standard even using AI (haha) to figure if coranks of an expression have restrictions on them, failed. I found nothing. AI fantasized about restrictions that did not exist. Therefore the current approach is to remove the conformance check and just use the computed coranks in expressions to prevent recomputaion whenever they needed. Jerry, Harald: Sorry for all the bother and all my mistakes. I am really sorry to have wasted your time. The patch has been regtested fine on x86_64-pc-linux-gnu / F41. Ok for mainline and later backport to gcc-15? Regards, Andre --- snip --- With this fixer patch, I can successfully compile Toon's test case. The patch also regression tests here OK. OK to push. Jerry
[PATCH] libquadmath: add quad support for trig-pi functions
Hi all, This patch adds the required function for Fortran trigonometric functions to work with glibc versions prior to 2.26. It's based on glibc source commit 632d895f3e5d98162f77b9c3c1da4ec19968b671. I've built it successfully on my end. Documentation is also included. Please take a look when you have a moment. Best regards, YuaoFrom 46ed3a1817e87567a7510eb4ca918589afcc9c3c Mon Sep 17 00:00:00 2001 From: Yuao Ma Date: Thu, 3 Jul 2025 00:40:58 +0800 Subject: [PATCH] libquadmath: add quad support for trig-pi functions This function is required for Fortran trigonometric functions with glibc <2.26. Use glibc commit 632d895f3e5d98162f77b9c3c1da4ec19968b671. libquadmath/ChangeLog: * Makefile.am: Add sources to makefile. * Makefile.in: Regen makefile. * libquadmath.texi: Add doc for trig-pi funcs. * update-quadmath.py: Update generation script. * math/acospiq.c: New file. * math/asinpiq.c: New file. * math/atan2piq.c: New file. * math/atanpiq.c: New file. * math/cospiq.c: New file. * math/sinpiq.c: New file. * math/tanpiq.c: New file. Signed-off-by: Yuao Ma --- libquadmath/Makefile.am| 2 ++ libquadmath/Makefile.in| 26 -- libquadmath/libquadmath.texi | 7 libquadmath/math/acospiq.c | 33 ++ libquadmath/math/asinpiq.c | 40 ++ libquadmath/math/atan2piq.c| 36 libquadmath/math/atanpiq.c | 35 +++ libquadmath/math/cospiq.c | 37 libquadmath/math/sinpiq.c | 44 libquadmath/math/tanpiq.c | 62 ++ libquadmath/update-quadmath.py | 48 ++ 11 files changed, 352 insertions(+), 18 deletions(-) create mode 100644 libquadmath/math/acospiq.c create mode 100644 libquadmath/math/asinpiq.c create mode 100644 libquadmath/math/atan2piq.c create mode 100644 libquadmath/math/atanpiq.c create mode 100644 libquadmath/math/cospiq.c create mode 100644 libquadmath/math/sinpiq.c create mode 100644 libquadmath/math/tanpiq.c diff --git a/libquadmath/Makefile.am b/libquadmath/Makefile.am index 93806106abb..a1b17fd7897 100644 --- a/libquadmath/Makefile.am +++ b/libquadmath/Makefile.am @@ -70,6 +70,8 @@ libquadmath_la_SOURCES = \ math/llrintq.c math/log2q.c math/lrintq.c math/nearbyintq.c math/remquoq.c \ math/ccoshq.c math/cexpq.c math/clog10q.c math/clogq.c math/csinq.c \ math/csinhq.c math/csqrtq.c math/ctanq.c math/ctanhq.c \ + math/acospiq.c math/asinpiq.c math/atanpiq.c math/atan2piq.c \ + math/cospiq.c math/sinpiq.c math/tanpiq.c \ printf/addmul_1.c printf/add_n.c printf/cmp.c printf/divrem.c \ printf/flt1282mpn.c printf/fpioconst.c printf/lshift.c printf/mul_1.c \ printf/mul_n.c printf/mul.c printf/printf_fphex.c printf/printf_fp.c \ diff --git a/libquadmath/Makefile.in b/libquadmath/Makefile.in index ff3373064b1..b1d542c 100644 --- a/libquadmath/Makefile.in +++ b/libquadmath/Makefile.in @@ -197,9 +197,13 @@ am__dirstamp = $(am__leading_dot)dirstamp @BUILD_LIBQUADMATH_TRUE@ math/clog10q.lo math/clogq.lo \ @BUILD_LIBQUADMATH_TRUE@ math/csinq.lo math/csinhq.lo \ @BUILD_LIBQUADMATH_TRUE@ math/csqrtq.lo math/ctanq.lo \ -@BUILD_LIBQUADMATH_TRUE@ math/ctanhq.lo printf/addmul_1.lo \ -@BUILD_LIBQUADMATH_TRUE@ printf/add_n.lo printf/cmp.lo \ -@BUILD_LIBQUADMATH_TRUE@ printf/divrem.lo printf/flt1282mpn.lo \ +@BUILD_LIBQUADMATH_TRUE@ math/ctanhq.lo math/acospiq.lo \ +@BUILD_LIBQUADMATH_TRUE@ math/asinpiq.lo math/atanpiq.lo \ +@BUILD_LIBQUADMATH_TRUE@ math/atan2piq.lo math/cospiq.lo \ +@BUILD_LIBQUADMATH_TRUE@ math/sinpiq.lo math/tanpiq.lo \ +@BUILD_LIBQUADMATH_TRUE@ printf/addmul_1.lo printf/add_n.lo \ +@BUILD_LIBQUADMATH_TRUE@ printf/cmp.lo printf/divrem.lo \ +@BUILD_LIBQUADMATH_TRUE@ printf/flt1282mpn.lo \ @BUILD_LIBQUADMATH_TRUE@ printf/fpioconst.lo printf/lshift.lo \ @BUILD_LIBQUADMATH_TRUE@ printf/mul_1.lo printf/mul_n.lo \ @BUILD_LIBQUADMATH_TRUE@ printf/mul.lo printf/printf_fphex.lo \ @@ -495,6 +499,8 @@ AUTOMAKE_OPTIONS = foreign info-in-builddir @BUILD_LIBQUADMATH_TRUE@ math/llrintq.c math/log2q.c math/lrintq.c math/nearbyintq.c math/remquoq.c \ @BUILD_LIBQUADMATH_TRUE@ math/ccoshq.c math/cexpq.c math/clog10q.c math/clogq.c math/csinq.c \ @BUILD_LIBQUADMATH_TRUE@ math/csinhq.c math/csqrtq.c math/ctanq.c math/ctanhq.c \ +@BUILD_LIBQUADMATH_TRUE@ math/acospiq.c math/asinpiq.c math/atanpiq.c math/atan2piq.c \ +@BUILD_LIBQUADMATH_TRUE@ math/cospiq.c math/sinpiq.c math/tanpiq.c \ @BUILD_LIBQUADMATH_TRUE@ printf/addmul_1.c printf/add_n.c printf/cmp.c printf/divrem.c \ @BUILD_LIBQUADMATH_TRUE@ printf/flt1282mpn.c printf/fpioconst.c printf/lshift.c printf/mul_1.c \ @BUILD_LIBQUADMATH_TRUE@ printf/mul_n.c printf/mul.c printf/printf_fphex.c printf/printf_
Re: [Fortran, Patch, PR120843, v3] Fix reject valid, because of inconformable coranks
Hi all, I successfully created a big mess with the previous patch. First of all by applying an outdated one and secondly by adding the conformance checks for coranks in a3f1cdd8ed46f9816b31ab162ae4dac547d34ebc. Checking the standard even using AI (haha) to figure if coranks of an expression have restrictions on them, failed. I found nothing. AI fantasized about restrictions that did not exist. Therefore the current approach is to remove the conformance check and just use the computed coranks in expressions to prevent recomputaion whenever they needed. Jerry, Harald: Sorry for all the bother and all my mistakes. I am really sorry to have wasted your time. The patch has been regtested fine on x86_64-pc-linux-gnu / F41. Ok for mainline and later backport to gcc-15? Regards, Andre On Tue, 1 Jul 2025 11:17:58 +0200 Andre Vehreschild wrote: > Hi Harald, > > thanks for the review. Committed as gcc-16-1885-g1b0930e9046. > > Will backport to gcc-15 in about a week. > > Thanks again. > > Regards, > Andre > > On Mon, 30 Jun 2025 22:31:08 +0200 > Harald Anlauf wrote: > > > Am 30.06.25 um 15:25 schrieb Andre Vehreschild: > > > Hi all, > > > > > > here now the version of the patch that seems to be more complete. > > > > > > Regtests ok on x86_64-pc-linux-gnu / F41. Ok for mainline and later > > > backport to gcc-15? > > > > This looks good to me. OK for both. > > > > Thanks for the patch! > > > > Harald > > > > > Regards, > > > Andre > > > > > > On Fri, 27 Jun 2025 15:44:20 +0200 > > > Andre Vehreschild wrote: > > > > > >> I take this patch back. It seems to be incomplete. > > >> > > >> - Andre > > >> > > >> On Fri, 27 Jun 2025 14:45:36 +0200 > > >> Andre Vehreschild wrote: > > >> > > >>> Hi all, > > >>> > > >>> this patch fixes a reject valid when the coranks of two operands do not > > >>> match and no coindex is given. I.e. when only an implicit this_image > > >>> co-ref is used. > > >>> > > >>> Regtests ok on x86_64-pc-linux-gnu / F41. Ok for mainline? > > >>> > > >>> Regards, > > >>> Andre > > >> > > >> > > > > > > > > > > -- Andre Vehreschild * Email: vehre ad gmx dot de From 3ad3d551fb457698b61ed459afa0b58bf8574df8 Mon Sep 17 00:00:00 2001 From: Andre Vehreschild Date: Wed, 2 Jul 2025 11:06:17 +0200 Subject: [PATCH] Fortran: Remove corank conformability checks [PR120843] Remove the checks on coranks conformability in expressions, because there is nothing in the standard about it. When a coarray has no coindexes it it treated like a non-coarray, when it has a full-corank coindex its result is a regular array. So nothing to check for corank conformability. PR fortran/120843 gcc/fortran/ChangeLog: * resolve.cc (resolve_operator): Remove conformability check, because it is not in the standard. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/coindexed_6.f90: Enhance test to have coarray components covered. --- gcc/fortran/resolve.cc| 29 --- .../gfortran.dg/coarray/coindexed_6.f90 | 13 +++-- 2 files changed, 10 insertions(+), 32 deletions(-) diff --git a/gcc/fortran/resolve.cc b/gcc/fortran/resolve.cc index 50a6fe7fc52..4a6e951cdf1 100644 --- a/gcc/fortran/resolve.cc +++ b/gcc/fortran/resolve.cc @@ -4807,35 +4807,6 @@ resolve_operator (gfc_expr *e) return false; } } - - /* coranks have to be equal or one has to be zero to be combinable. */ - if (op1->corank == op2->corank || (op1->corank != 0 && op2->corank == 0)) - { - e->corank = op1->corank; - /* Only do this, when regular array has not set a shape yet. */ - if (e->shape == NULL) - { - if (op1->corank != 0) - { - e->shape = gfc_copy_shape (op1->shape, op1->corank); - } - } - } - else if (op1->corank == 0 && op2->corank != 0) - { - e->corank = op2->corank; - /* Only do this, when regular array has not set a shape yet. */ - if (e->shape == NULL) - e->shape = gfc_copy_shape (op2->shape, op2->corank); - } - else if ((op1->ref && !gfc_ref_this_image (op1->ref)) - || (op2->ref && !gfc_ref_this_image (op2->ref))) - { - gfc_error ("Inconsistent coranks for operator at %L and %L", - &op1->where, &op2->where); - return false; - } - break; case INTRINSIC_PARENTHESES: diff --git a/gcc/testsuite/gfortran.dg/coarray/coindexed_6.f90 b/gcc/testsuite/gfortran.dg/coarray/coindexed_6.f90 index 8f5dcabb859..d566c504134 100644 --- a/gcc/testsuite/gfortran.dg/coarray/coindexed_6.f90 +++ b/gcc/testsuite/gfortran.dg/coarray/coindexed_6.f90 @@ -5,13 +5,20 @@ program p implicit none - integer, allocatable :: arr(:,:) [:,:] + type T +integer, allocatable :: arr(:,:) [:,:] + end type + + type(T) :: o + integer, allocatable :: vec(:)[:,:] integer :: c[*] c = 7 - allocate(arr(4,3)[2,*], source=6) + allocate(o%arr(4,3)[2,*], source=6) + allocate(vec(10)[1,*], source=7) - if (arr(2,2)* c /= 42) stop 1 + if (vec(
Re: [Fortran, Patch, PR120843, v3] Fix reject valid, because of inconformable coranks
On Wed, Jul 02, 2025 at 04:36:38AM -0700, Damian Rouson wrote: > git branch > gir checkout > git add > git commit > git rebase > git push > > It’s time to move beyond emailing patches! (Please.) I don't use git other than 'git clone', 'git reset --hard', and 'git diff'. If gfortran development goes this route, I am done. -- steve
Re: [Fortran, Patch, PR120843, v3] Fix reject valid, because of inconformable coranks
git branch gir checkout git add git commit git rebase git push It’s time to move beyond emailing patches! (Please.) Damian On Wed, Jul 2, 2025 at 03:17 Andre Vehreschild wrote: > Hi all, > > I successfully created a big mess with the previous patch. First of all by > applying an outdated one and secondly by adding the conformance checks for > coranks in a3f1cdd8ed46f9816b31ab162ae4dac547d34ebc. Checking the standard > even > using AI (haha) to figure if coranks of an expression have restrictions on > them, failed. I found nothing. AI fantasized about restrictions that did > not > exist. Therefore the current approach is to remove the conformance check > and > just use the computed coranks in expressions to prevent recomputaion > whenever > they needed. > > Jerry, Harald: Sorry for all the bother and all my mistakes. I am really > sorry > to have wasted your time. > > The patch has been regtested fine on x86_64-pc-linux-gnu / F41. Ok for > mainline > and later backport to gcc-15? > > Regards, > Andre > > On Tue, 1 Jul 2025 11:17:58 +0200 > Andre Vehreschild wrote: > > > Hi Harald, > > > > thanks for the review. Committed as gcc-16-1885-g1b0930e9046. > > > > Will backport to gcc-15 in about a week. > > > > Thanks again. > > > > Regards, > > Andre > > > > On Mon, 30 Jun 2025 22:31:08 +0200 > > Harald Anlauf wrote: > > > > > Am 30.06.25 um 15:25 schrieb Andre Vehreschild: > > > > Hi all, > > > > > > > > here now the version of the patch that seems to be more complete. > > > > > > > > Regtests ok on x86_64-pc-linux-gnu / F41. Ok for mainline and later > > > > backport to gcc-15? > > > > > > This looks good to me. OK for both. > > > > > > Thanks for the patch! > > > > > > Harald > > > > > > > Regards, > > > > Andre > > > > > > > > On Fri, 27 Jun 2025 15:44:20 +0200 > > > > Andre Vehreschild wrote: > > > > > > > >> I take this patch back. It seems to be incomplete. > > > >> > > > >> - Andre > > > >> > > > >> On Fri, 27 Jun 2025 14:45:36 +0200 > > > >> Andre Vehreschild wrote: > > > >> > > > >>> Hi all, > > > >>> > > > >>> this patch fixes a reject valid when the coranks of two operands > do not > > > >>> match and no coindex is given. I.e. when only an implicit > this_image > > > >>> co-ref is used. > > > >>> > > > >>> Regtests ok on x86_64-pc-linux-gnu / F41. Ok for mainline? > > > >>> > > > >>> Regards, > > > >>> Andre > > > >> > > > >> > > > > > > > > > > > > > > > > > > -- > Andre Vehreschild * Email: vehre ad gmx dot de >