[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #25 from Jakub Jelinek --- Author: jakub Date: Fri May 17 19:56:14 2019 New Revision: 271358 URL: https://gcc.gnu.org/viewcvs?rev=271358=gcc=rev Log: PR fortran/54613 * gfortran.map (GFORTRAN_9.2): Export _gfortran_{,m,s}findloc{0,1}_r10. * Makefile.am (i_findloc0_c): Add $(srcdir)/generated/findloc0_r10.c. (i_findloc1_c): Add $(srcdir)/generated/findloc1_r10.c. * Makefile.in: Regenerated. * generated/findloc0_r10.c: Generated. * generated/findloc1_r10.c: Generated. Added: branches/gcc-9-branch/libgfortran/generated/findloc0_r10.c branches/gcc-9-branch/libgfortran/generated/findloc1_r10.c Modified: branches/gcc-9-branch/libgfortran/ChangeLog branches/gcc-9-branch/libgfortran/Makefile.am branches/gcc-9-branch/libgfortran/Makefile.in branches/gcc-9-branch/libgfortran/gfortran.map
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #24 from Jakub Jelinek --- Author: jakub Date: Fri May 17 19:54:46 2019 New Revision: 271357 URL: https://gcc.gnu.org/viewcvs?rev=271357=gcc=rev Log: PR fortran/54613 * gfortran.map (GFORTRAN_9.2): New symbol version, export _gfortran_{,m,s}findloc0_i2 in it. Modified: branches/gcc-9-branch/libgfortran/ChangeLog branches/gcc-9-branch/libgfortran/gfortran.map
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #23 from Jakub Jelinek --- Author: jakub Date: Fri May 17 17:50:55 2019 New Revision: 271336 URL: https://gcc.gnu.org/viewcvs?rev=271336=gcc=rev Log: PR fortran/54613 * gfortran.map (GFORTRAN_9.2): Export _gfortran_{,m,s}findloc{0,1}_r10. * Makefile.am (i_findloc0_c): Add $(srcdir)/generated/findloc0_r10.c. (i_findloc1_c): Add $(srcdir)/generated/findloc1_r10.c. * Makefile.in: Regenerated. * generated/findloc0_r10.c: Generated. * generated/findloc1_r10.c: Generated. Added: trunk/libgfortran/generated/findloc0_r10.c trunk/libgfortran/generated/findloc1_r10.c
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #22 from Jakub Jelinek --- Author: jakub Date: Fri May 17 17:24:27 2019 New Revision: 271335 URL: https://gcc.gnu.org/viewcvs?rev=271335=gcc=rev Log: PR fortran/54613 * gfortran.map (GFORTRAN_9.2): Export _gfortran_{,m,s}findloc{0,1}_r10. * Makefile.am (i_findloc0_c): Add $(srcdir)/generated/findloc0_r10.c. (i_findloc1_c): Add $(srcdir)/generated/findloc1_r10.c. * Makefile.in: Regenerated. * generated/findloc0_r10.c: Generated. * generated/findloc1_r10.c: Generated. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/Makefile.am trunk/libgfortran/Makefile.in trunk/libgfortran/gfortran.map
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #21 from Jakub Jelinek --- Author: jakub Date: Fri May 17 17:23:30 2019 New Revision: 271334 URL: https://gcc.gnu.org/viewcvs?rev=271334=gcc=rev Log: PR fortran/54613 * gfortran.map (GFORTRAN_9.2): New symbol version, export _gfortran_{,m,s}findloc0_i2 in it. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/gfortran.map
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #20 from Thomas Koenig --- Author: tkoenig Date: Thu Nov 1 20:12:57 2018 New Revision: 265732 URL: https://gcc.gnu.org/viewcvs?rev=265732=gcc=rev Log: 2017-11-01 Thomas Koenig PR fortran/54613 * gfortran.dg/findloc_1.f90: Actually commit. * gfortran.dg/findloc_2.f90: Actually commit. * gfortran.dg/findloc_3.f90: Actually commit. * gfortran.dg/findloc_4.f90: Actually commit. * gfortran.dg/findloc_5.f90: Actually commit. * gfortran.dg/findloc_6.f90: Actually commit. Added: trunk/gcc/testsuite/gfortran.dg/findloc_1.f90 trunk/gcc/testsuite/gfortran.dg/findloc_2.f90 trunk/gcc/testsuite/gfortran.dg/findloc_3.f90 trunk/gcc/testsuite/gfortran.dg/findloc_4.f90 trunk/gcc/testsuite/gfortran.dg/findloc_5.f90 trunk/gcc/testsuite/gfortran.dg/findloc_6.f90 trunk/gcc/testsuite/gfortran.dg/findloc_7.f90 Modified: trunk/gcc/testsuite/ChangeLog
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #19 from Thomas Koenig --- Author: tkoenig Date: Thu Nov 1 11:37:08 2018 New Revision: 265715 URL: https://gcc.gnu.org/viewcvs?rev=265715=gcc=rev Log: 2018-10-28 Thomas Koenig PR fortran/54613 * gfortran.texi (File format of unformatted sequential files): Replace random comma with period. * intrinsic.texi (Intrinsic Procedures): Add FINDLOC to menu. (FINDLOC): Document. (MAXLOC): Add refrence to FINDLOC. (MINLOC): Likewise. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/gfortran.texi trunk/gcc/fortran/intrinsic.texi
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 Thomas Koenig changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #18 from Thomas Koenig --- Implemented, closing.
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #17 from Thomas Koenig --- Author: tkoenig Date: Sun Oct 28 11:05:05 2018 New Revision: 265570 URL: https://gcc.gnu.org/viewcvs?rev=265570=gcc=rev Log: 2017-10-28 Thomas Koenig PR fortran/54613 * gfortran.h (gfc_isym_id): Add GFC_ISYM_FINDLOC. (gfc_check_f): Add f6fl field. (gfc_simplify_f): Add f6 field. (gfc_resolve_f): Likewise. (gfc_type_letter): Add optional logical_equas_int flag. * check.c (intrinsic_type_check): New function. (gfc_check_findloc): New function. * intrinsics.c (gfc_type_letter): If logical_equals_int is set, act accordingly. (add_sym_5ml): Reformat comment. (add_sym_6fl): New function. (add_functions): Add findloc. (check_arglist): Add sixth argument, handle it. (resolve_intrinsic): Likewise. (check_specific): Handle findloc. * intrinsic.h (gfc_check_findloc): Add prototype. (gfc_simplify_findloc): Likewise. (gfc_resolve_findloc): Likewise. (MAX_INTRINSIC_ARGS): Adjust. * iresolve.c (gfc_resolve_findloc): New function. * simplify.c (gfc_simplify_minmaxloc): Make static. (simplify_findloc_to_scalar): New function. (simplify_findloc_nodim): New function. (simplify_findloc_to_array): New function. (gfc_simplify_findloc): New function. (gfc_conv_intrinsic_findloc): New function. (gfc_conv_intrinsic_function): Handle GFC_ISYM_FINDLOC. (gfc_is_intrinsic_libcall): Likewise. 2017-10-28 Thomas Koenig PR fortran/54613 * Makefile.am: Add files for findloc. * Makefile.in: Regenerated. * libgfortran.h (gfc_array_index_type): Add. (gfc_array_s1): Add using GFC_UINTEGER_1. (gfc_array_s4): Likewise. Replace unnecessary comment. (HAVE_GFC_UINTEGER_1): Define. (HAVE_GFC_UINTEGER_4): Define. * m4/findloc0.m4: New file. * m4/findloc0s.m4: New file. * m4/findloc1.m4: New file. * m4/findloc1s.m4: New file. * m4/findloc2s.m4: New file. * m4/ifindloc0.m4: New file. * m4/ifindloc1.m4: New file. * m4/ifindloc2.m4: New file. * m4/iparm.m4: Use unsigned integer for characters. * generated/findloc0_c16.c: New file. * generated/findloc0_c4.c: New file. * generated/findloc0_c8.c: New file. * generated/findloc0_i1.c: New file. * generated/findloc0_i16.c: New file. * generated/findloc0_i2.c: New file. * generated/findloc0_i4.c: New file. * generated/findloc0_i8.c: New file. * generated/findloc0_r16.c: New file. * generated/findloc0_r4.c: New file. * generated/findloc0_r8.c: New file. * generated/findloc0_s1.c: New file. * generated/findloc0_s4.c: New file. * generated/findloc1_c16.c: New file. * generated/findloc1_c4.c: New file. * generated/findloc1_c8.c: New file. * generated/findloc1_i1.c: New file. * generated/findloc1_i16.c: New file. * generated/findloc1_i2.c: New file. * generated/findloc1_i4.c: New file. * generated/findloc1_i8.c: New file. * generated/findloc1_r16.c: New file. * generated/findloc1_r4.c: New file. * generated/findloc1_r8.c: New file. * generated/findloc1_s1.c: New file. * generated/findloc1_s4.c: New file. * generated/findloc2_s1.c: New file. * generated/findloc2_s4.c: New file. * generated/maxloc0_16_s1.c: Regenerated. * generated/maxloc0_16_s4.c: Regenerated. * generated/maxloc0_4_s1.c: Regenerated. * generated/maxloc0_4_s4.c: Regenerated. * generated/maxloc0_8_s1.c: Regenerated. * generated/maxloc0_8_s4.c: Regenerated. * generated/maxloc1_16_s1.c: Regenerated. * generated/maxloc1_16_s4.c: Regenerated. * generated/maxloc1_4_s1.c: Regenerated. * generated/maxloc1_4_s4.c: Regenerated. * generated/maxloc1_8_s1.c: Regenerated. * generated/maxloc1_8_s4.c: Regenerated. * generated/maxloc2_16_s1.c: Regenerated. * generated/maxloc2_16_s4.c: Regenerated. * generated/maxloc2_4_s1.c: Regenerated. * generated/maxloc2_4_s4.c: Regenerated. * generated/maxloc2_8_s1.c: Regenerated. * generated/maxloc2_8_s4.c: Regenerated. * generated/maxval0_s1.c: Regenerated. * generated/maxval0_s4.c: Regenerated. * generated/maxval1_s1.c: Regenerated. * generated/maxval1_s4.c: Regenerated. * generated/minloc0_16_s1.c: Regenerated. * generated/minloc0_16_s4.c: Regenerated. * generated/minloc0_4_s1.c: Regenerated. * generated/minloc0_4_s4.c: Regenerated. * generated/minloc0_8_s1.c: Regenerated. * generated/minloc0_8_s4.c: Regenerated.
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #16 from Thomas Koenig --- Here are test cases. I tried to walk through most of the code paths. ! { dg-do run } ! Various tests with findloc. program main implicit none real, dimension(2,2) :: a, b integer, dimension(2,3) :: c logical, dimension(2,2) :: lo integer, dimension(:), allocatable :: e a = reshape([1.,2.,3.,4.], shape(a)) b = reshape([1.,2.,1.,2.], shape(b)) lo = .true. if (any(findloc(a, 5.) /= [0,0])) stop 1 if (any(findloc(a, 5., back=.true.) /= [0,0])) stop 2 if (any(findloc(a, 2.) /= [2,1])) stop 2 if (any(findloc(a, 2. ,back=.true.) /= [2,1])) stop 3 if (any(findloc(a,3.,mask=lo) /= [1,2])) stop 4 if (any(findloc(a,3,mask=.true.) /= [1,2])) stop 5 lo(1,2) = .false. if (any(findloc(a,3.,mask=lo) /= [0,0])) stop 6 if (any(findloc(b,2.) /= [2,1])) stop 7 if (any(findloc(b,2.,back=.true.) /= [2,2])) stop 8 if (any(findloc(b,1.,mask=lo,back=.true.) /= [1,1])) stop 9 if (any(findloc(b,1.,mask=.false.) /= [0,0])) stop 10 c = reshape([1,2,2,2,-9,6], shape(c)) if (any(findloc(c,value=2,dim=1) /= [2,1,0])) stop 11 if (any(findloc(c,value=2,dim=2) /= [2,1])) stop 12 end program main ! { dg-do run } ! Various tests with findloc with character variables. program main character(len=2) :: a(3,3), c(3,3), d(3,4) character(len=3) :: b(3,3) integer :: ret(2) integer :: i,j character(len=3) :: s logical :: lo logical, dimension(3,4) :: msk data a /"11", "21", "31", "12", "22", "32", "13", "23", "33" / data b /"11 ", "21 ", "31 ", "12 ", "22 ", "32 ", "13 ", "23 ", "33 " / if (any(findloc(a,"11 ") /= [1,1])) stop 1 ret = findloc(b,"31") do j=1,3 do i=1,3 write(unit=s,fmt='(2I1," ")') i,j ret = findloc(b,s) if (b(ret(1),ret(2)) /= s) stop 2 end do end do if (any(findloc(b(::2,::2),"13") /= [1,2])) stop 3 do j=1,3 do i=1,3 write(unit=c(i,j),fmt='(I2)') 2+i-j end do end do if (any(findloc(c," 1") /= [1,2])) stop 4 if (any(findloc(c," 1", back=.true.) /= [2,3])) stop 5 if (any(findloc(c," 1", back=.true., mask=.false.) /= [0,0])) stop 6 lo = .true. if (any(findloc(c," 2", dim=1) /= [1,2,3])) stop 7 if (any(findloc(c," 2",dim=1,mask=lo) /= [1,2,3])) stop 8 if (any(findloc(c," 2", dim=1,back=.true.) /= [1,2,3])) stop 9 if (any(findloc(c," 2",dim=1,mask=lo,back=.true.) /= [1,2,3])) stop 10 do j=1,4 do i=1,3 if (j<= i) then d(i,j) = "AA" else d(i,j) = "BB" end if end do end do print '(4A3)', transpose(d) if (any(findloc(d,"AA") /= [1,1])) stop 11 if (any(findloc(d,"BB") /= [1,2])) stop 12 msk = .true. if (any(findloc(d,"AA", mask=msk) /= [1,1])) stop 11 if (any(findloc(d,"BB", mask=msk) /= [1,2])) stop 12 if (any(findloc(d,"AA", dim=1) /= [1,2,3,0])) stop 13 if (any(findloc(d,"BB", dim=1) /= [0,1,1,1])) stop 14 if (any(findloc(d,"AA", dim=2) /= [1,1,1])) stop 15 if (any(findloc(d,"BB", dim=2) /= [2,3,4])) stop 16 if (any(findloc(d,"AA", dim=1,mask=msk) /= [1,2,3,0])) stop 17 if (any(findloc(d,"BB", dim=1,mask=msk) /= [0,1,1,1])) stop 18 if (any(findloc(d,"AA", dim=2,mask=msk) /= [1,1,1])) stop 19 if (any(findloc(d,"BB", dim=2,mask=msk) /= [2,3,4])) stop 20 if (any(findloc(d,"AA", dim=1, back=.true.) /= [3,3,3,0])) stop 21 if (any(findloc(d,"AA", dim=1, back=.true., mask=msk) /= [3,3,3,0])) stop 22 if (any(findloc(d,"BB", dim=2, back=.true.) /= [4,4,4])) stop 23 if (any(findloc(d,"BB", dim=2, back=.true.,mask=msk) /= [4,4,4])) stop 24 msk(1,:) = .false. print '(4L3)', transpose(msk) if (any(findloc(d,"AA", dim=1,mask=msk) /= [2,2,3,0])) stop 21 if (any(findloc(d,"BB", dim=2,mask=msk) /= [0,3,4])) stop 22 if (any(findloc(d,"AA", dim=2, mask=msk, back=.true.) /= [0,2,3])) stop 23 if (any(findloc(d,"AA", dim=1, mask=msk, back=.true.) /= [3,3,3,0])) stop 24 end program main
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 Thomas Koenig changed: What|Removed |Added Attachment #44834|0 |1 is obsolete|| --- Comment #15 from Thomas Koenig --- Created attachment 44840 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44840=edit Patch for the library version, minus quite a few bugs OK, so here is something that people can actually test. It currently has no support for simplification and no support for findloc(rank_one_array,value,dim=1), but otherwise it looks quite good. If you apply this, the libgfortran/generated/findloc* files will be added; if you apply it for a second time, everything will be added twice in the files, which will lead to many confusing error messages :-) Currently, you have to add -static-libgfortran to the command line for this to work, because I didn't add the symbols to gfortran.map yet (but this should be straightforward). Design decision: To avoid combinatorial explosion, the library files use index_type only. For other integer kinds, the results are converted on return.
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 Thomas Koenig changed: What|Removed |Added Attachment #43200|0 |1 is obsolete|| Attachment #43226|0 |1 is obsolete|| Attachment #44813|0 |1 is obsolete|| --- Comment #14 from Thomas Koenig --- Created attachment 44834 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44834=edit Patch for findloc library version without dim Here's a version which adds findloc support without dim, both for character and non-character data.
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 Thomas Koenig changed: What|Removed |Added Attachment #44803|0 |1 is obsolete|| --- Comment #13 from Thomas Koenig --- Created attachment 44813 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44813=edit Patch with a first version of a library function At least BACK appears to work already.
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #12 from Thomas Koenig --- Created attachment 44803 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44803=edit First piece of the work... This adds the parsing, checking, resolution and calling of the library routines (if any). Still a very large piece of work to be done...
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 janus at gcc dot gnu.org changed: What|Removed |Added CC||janus at gcc dot gnu.org --- Comment #11 from janus at gcc dot gnu.org --- (In reply to Thomas Koenig from comment #4) > Still to do: FINDLOC and BACK. It seems that BACK is done by now, while FINDLOC is still to do.
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #10 from Thomas Koenig --- Author: tkoenig Date: Thu May 10 14:31:54 2018 New Revision: 260116 URL: https://gcc.gnu.org/viewcvs?rev=260116=gcc=rev Log: 2018-05-10 Thomas KoenigPR fortran/54613 * intrinsic.texi: Document BACK for MINLOC and MAXLOC. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/intrinsic.texi
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #9 from Thomas Koenig --- Author: tkoenig Date: Tue May 8 07:47:19 2018 New Revision: 260023 URL: https://gcc.gnu.org/viewcvs?rev=260023=gcc=rev Log: 2018-05-08 Thomas KoenigPR fortran/54613 * check.c (gfc_check_minmaxloc): Remove error for BACK not being implemented. Use gfc_logical_4_kind for BACK. * simplify.c (min_max_choose): Add optional argument back_val. Handle it. (simplify_minmaxloc_to_scalar): Add argument back_val. Pass back_val to min_max_choose. (simplify_minmaxloc_to_nodim): Likewise. (simplify_minmaxloc_to_array): Likewise. (gfc_simplify_minmaxloc): Add argument back, handle it. Pass back_val to specific simplification functions. (gfc_simplify_minloc): Remove ATTRIBUTE_UNUSED from argument back, pass it on to gfc_simplify_minmaxloc. (gfc_simplify_maxloc): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_minmaxloc): Adjust comment. If BACK is true, use greater or equal (or lesser or equal) insteal of greater (or lesser). Mark the condition of having found a value which exceeds the limit as unlikely. 2018-05-08 Thomas Koenig PR fortran/54613 * m4/iforeach-s.m4: Remove assertion that back is zero. * m4/iforeach.m4: Likewise. Remove leading 'do' before implementation start. * m4/ifunction-s.m4: Remove assertion that back is zero. * m4/ifunction.m4: Likewise. Remove for loop if HAVE_BACK_ARG is defined. * m4/maxloc0.m4: Reorganize loops. Split loops between >= and =, depending if back is true. Mark the condition of having found a value which exceeds the limit as unlikely. * m4/minloc0.m4: Likewise. * m4/maxloc1.m4: Likewise. * m4/minloc1.m4: Likewise. * m4/maxloc1s.m4: Handle back argument. * m4/minloc1s.m4: Likewise. * m4/maxloc2s.m4: Remove assertion that back is zero. Remove special handling of loop start. Handle back argument. * m4/minloc2s.m4: Likewise. * generated/iall_i1.c: Regenerated. * generated/iall_i16.c: Regenerated. * generated/iall_i2.c: Regenerated. * generated/iall_i4.c: Regenerated. * generated/iall_i8.c: Regenerated. * generated/iany_i1.c: Regenerated. * generated/iany_i16.c: Regenerated. * generated/iany_i2.c: Regenerated. * generated/iany_i4.c: Regenerated. * generated/iany_i8.c: Regenerated. * generated/iparity_i1.c: Regenerated. * generated/iparity_i16.c: Regenerated. * generated/iparity_i2.c: Regenerated. * generated/iparity_i4.c: Regenerated. * generated/iparity_i8.c: Regenerated. * generated/maxloc0_16_i1.c: Regenerated. * generated/maxloc0_16_i16.c: Regenerated. * generated/maxloc0_16_i2.c: Regenerated. * generated/maxloc0_16_i4.c: Regenerated. * generated/maxloc0_16_i8.c: Regenerated. * generated/maxloc0_16_r10.c: Regenerated. * generated/maxloc0_16_r16.c: Regenerated. * generated/maxloc0_16_r4.c: Regenerated. * generated/maxloc0_16_r8.c: Regenerated. * generated/maxloc0_16_s1.c: Regenerated. * generated/maxloc0_16_s4.c: Regenerated. * generated/maxloc0_4_i1.c: Regenerated. * generated/maxloc0_4_i16.c: Regenerated. * generated/maxloc0_4_i2.c: Regenerated. * generated/maxloc0_4_i4.c: Regenerated. * generated/maxloc0_4_i8.c: Regenerated. * generated/maxloc0_4_r10.c: Regenerated. * generated/maxloc0_4_r16.c: Regenerated. * generated/maxloc0_4_r4.c: Regenerated. * generated/maxloc0_4_r8.c: Regenerated. * generated/maxloc0_4_s1.c: Regenerated. * generated/maxloc0_4_s4.c: Regenerated. * generated/maxloc0_8_i1.c: Regenerated. * generated/maxloc0_8_i16.c: Regenerated. * generated/maxloc0_8_i2.c: Regenerated. * generated/maxloc0_8_i4.c: Regenerated. * generated/maxloc0_8_i8.c: Regenerated. * generated/maxloc0_8_r10.c: Regenerated. * generated/maxloc0_8_r16.c: Regenerated. * generated/maxloc0_8_r4.c: Regenerated. * generated/maxloc0_8_r8.c: Regenerated. * generated/maxloc0_8_s1.c: Regenerated. * generated/maxloc0_8_s4.c: Regenerated. * generated/maxloc1_16_i1.c: Regenerated. * generated/maxloc1_16_i16.c: Regenerated. * generated/maxloc1_16_i2.c: Regenerated. * generated/maxloc1_16_i4.c: Regenerated. * generated/maxloc1_16_i8.c: Regenerated. * generated/maxloc1_16_r10.c: Regenerated. * generated/maxloc1_16_r16.c: Regenerated. * generated/maxloc1_16_r4.c: Regenerated. * generated/maxloc1_16_r8.c: Regenerated. *
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #8 from Thomas Koenig --- Created attachment 43226 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43226=edit Patch which should not slow down things This seems to be better from the timing perspective for the library versions.
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 Thomas Koenig changed: What|Removed |Added Attachment #28211|0 |1 is obsolete|| --- Comment #7 from Thomas Koenig --- Created attachment 43200 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43200=edit Draft patch for BACK, slows down some cases This patch implements the functionality, but there are still issues with speed. Putting in the condition for back inside a hot loop slows down things too much.. Here are some numbers: program main real, dimension(1000,1000) :: a real, dimension(1000*1000) :: b call random_number(a) call cpu_time (t1) print *,minloc(a) call cpu_time (t2) print *,t2-t1 call random_number(b) call cpu_time (t1) print *,minloc(b,dim=1) call cpu_time (t2) print *,t2-t1 end program main "gfortran" is gcc-8 with the patch, "/usr/bin/gfortran" is gcc-7. $ gfortran -O3 bench.f90 && ./a.out 4.58569974E-02 7.76470006E-02 $ gfortran -Ofast bench.f90 && ./a.out 4.58849967E-02 4.99750078E-02 $ /usr/bin/gfortran -O3 bench.f90 && ./a.out 3.56819928E-02 7.77039826E-02 $ /usr/bin/gfortran -Ofast bench.f90 && ./a.out 4.05109972E-02 4.98609543E-02 So, the inline version appears to be OK, the library version is slower.
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 --- Comment #6 from Thomas Koenig --- Author: tkoenig Date: Mon Jan 15 18:35:13 2018 New Revision: 256705 URL: https://gcc.gnu.org/viewcvs?rev=256705=gcc=rev Log: 2018-01-15 Thomas KoenigPR fortran/54613 * gfortran.h (gfc_check_f): Rename f4ml to f5ml. (gfc_logical_4_kind): New macro * intrinsic.h (gfc_simplify_minloc): Add a gfc_expr *argument. (gfc_simplify_maxloc): Likewise. (gfc_resolve_maxloc): Likewise. (gfc_resolve_minloc): Likewise. * check.c (gfc_check_minloc_maxloc): Add checking for "back" argument; also raise error if it is used (for now). Add it if it isn't present. * intrinsic.c (add_sym_4ml): Rename to (add_sym_5ml), adjust for extra argument. (add_functions): Add "back" constant. Adjust maxloc and minloc for back argument. * iresolve.c (gfc_resolve_maxloc): Add back argument. If back is not of gfc_logical_4_kind, convert. (gfc_resolve_minloc): Likewise. * simplify.c (gfc_simplify_minloc): Add back argument. (gfc_simplify_maxloc): Likewise. * trans-intinsic.c (gfc_conv_intrinsic_minmaxloc): Rename last argument to %VAL to ensure passing by value. (gfc_conv_intrinsic_function): Call gfc_conv_intrinsic_minmaxloc also for library calls. 2018-01-15 Thomas Koenig PR fortran/54613 * m4/iparm.m4: Add back_arg macro if in minloc or maxloc. * m4/iforeach-s.m4: Add optional argument back with back_arg macro. Improve m4 quoting. If HAVE_BACK_ARG is defined, assert that back is non-true. * m4/iforeach.m4: Likewise. * m4/ifunction-s.m4: Likewise. * m4/ifunction.m4: Likewise. * m4/maxloc0.m4: Include assert.h * m4/minloc0.m4: Likewise. * m4/maxloc0s.m4: #define HAVE_BACK_ARG. * m4/minloc0s.m4: Likewise. * m4/maxloc1s.m4: Likewise. * m4/minloc1s.m4: Likewise. * m4/maxloc1.m4: Include assert.h, #define HAVE_BACK_ARG. * m4/minloc1.m4: Likewise. * m4/maxloc2s.m4: Add assert.h, add back_arg, assert that back is non-true. * m4/minloc2s.m4: Likewise. * generated/iall_i1.c: Regenerated. * generated/iall_i16.c: Regenerated. * generated/iall_i2.c: Regenerated. * generated/iall_i4.c: Regenerated. * generated/iall_i8.c: Regenerated. * generated/iany_i1.c: Regenerated. * generated/iany_i16.c: Regenerated. * generated/iany_i2.c: Regenerated. * generated/iany_i4.c: Regenerated. * generated/iany_i8.c: Regenerated. * generated/iparity_i1.c: Regenerated. * generated/iparity_i16.c: Regenerated. * generated/iparity_i2.c: Regenerated. * generated/iparity_i4.c: Regenerated. * generated/iparity_i8.c: Regenerated. * generated/maxloc0_16_i1.c: Regenerated. * generated/maxloc0_16_i16.c: Regenerated. * generated/maxloc0_16_i2.c: Regenerated. * generated/maxloc0_16_i4.c: Regenerated. * generated/maxloc0_16_i8.c: Regenerated. * generated/maxloc0_16_r10.c: Regenerated. * generated/maxloc0_16_r16.c: Regenerated. * generated/maxloc0_16_r4.c: Regenerated. * generated/maxloc0_16_r8.c: Regenerated. * generated/maxloc0_16_s1.c: Regenerated. * generated/maxloc0_16_s4.c: Regenerated. * generated/maxloc0_4_i1.c: Regenerated. * generated/maxloc0_4_i16.c: Regenerated. * generated/maxloc0_4_i2.c: Regenerated. * generated/maxloc0_4_i4.c: Regenerated. * generated/maxloc0_4_i8.c: Regenerated. * generated/maxloc0_4_r10.c: Regenerated. * generated/maxloc0_4_r16.c: Regenerated. * generated/maxloc0_4_r4.c: Regenerated. * generated/maxloc0_4_r8.c: Regenerated. * generated/maxloc0_4_s1.c: Regenerated. * generated/maxloc0_4_s4.c: Regenerated. * generated/maxloc0_8_i1.c: Regenerated. * generated/maxloc0_8_i16.c: Regenerated. * generated/maxloc0_8_i2.c: Regenerated. * generated/maxloc0_8_i4.c: Regenerated. * generated/maxloc0_8_i8.c: Regenerated. * generated/maxloc0_8_r10.c: Regenerated. * generated/maxloc0_8_r16.c: Regenerated. * generated/maxloc0_8_r4.c: Regenerated. * generated/maxloc0_8_r8.c: Regenerated. * generated/maxloc0_8_s1.c: Regenerated. * generated/maxloc0_8_s4.c: Regenerated. * generated/maxloc1_16_i1.c: Regenerated. * generated/maxloc1_16_i16.c: Regenerated. * generated/maxloc1_16_i2.c: Regenerated. * generated/maxloc1_16_i4.c: Regenerated. * generated/maxloc1_16_i8.c: Regenerated. * generated/maxloc1_16_r10.c: Regenerated. * generated/maxloc1_16_r16.c: Regenerated. *
[Bug fortran/54613] [F08] Add FINDLOC plus support MAXLOC/MINLOC with KIND=/BACK=
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=54613 Thomas Koenig changed: What|Removed |Added Status|NEW |ASSIGNED Blocks||39627 Assignee|unassigned at gcc dot gnu.org |tkoenig at gcc dot gnu.org Summary|[F03] [F08] Add FINDLOC |[F08] Add FINDLOC plus |plus support MAXLOC/MINLOC |support MAXLOC/MINLOC with |with KIND=/BACK=|KIND=/BACK= --- Comment #5 from Thomas Koenig --- I'll take a shot, but this will take a while. If anybody else wants to chime in, feel free :-) Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=39627 [Bug 39627] [meta-bug] Fortran 2008 support