[Bug libfortran/30533] minval, maxval missing for kind=1 and kind=2
--- Comment #11 from tkoenig at gcc dot gnu dot org 2007-02-19 20:49 --- Subject: Bug 30533 Author: tkoenig Date: Mon Feb 19 20:49:10 2007 New Revision: 122137 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=122137 Log: 2007-02-19 Thomas Koenig [EMAIL PROTECTED] PR libfortran/30533 PR libfortran/30765 * Makefile.am: Add $(srcdir) too all files in generated/. (i_maxloc0_c): Add maxloc0_4_i1.c, maxloc0_8_i1.c, maxloc0_16_i1.c, maxloc0_4_i2.c, maxloc0_8_i2.c and maxloc0_16_i2.c. (i_maxloc1_c): Add maxloc1_4_i1.c, maxloc1_8_i1.c, maxloc1_16_i1.c, maxloc1_4_i2.c, maxloc1_8_i2.c and maxloc1_16_i2.c. (i_maxval_c): Add maxval_i1.c and maxval_i2.c. (i_minloc0_c): Add minloc0_4_i1.c, minloc0_8_i1.c, minloc0_16_i1.c, minloc0_4_i2.c, minloc0_8_i2.c and minloc0_16_i2.c. (i_minloc_1.c): Add minloc1_4_i1.c, minloc1_8_i1.c, minloc1_16_i1.c, minloc1_4_i2.c, minloc1_8_i2.c and minloc1_16_i2.c. (i_minval_c): Add minval_i1.c and minval_i2.c. (i_sum_c): Add sum_i1.c and sum_i2.c. (i_product_c): Add product_i1.c and product_i2.c. (i_matmul_c): Add matmul_i1.c and matmul_i2.c. (gfor_built_specific_src): Remove $(srcdir) from target. (gfor_bulit_specific2_src): Likewise. Makefile.in: Regenerated. libgfortran.h: Add GFC_INTEGER_1_HUGE and GFC_INTEGER_2_HUGE. Add gfc_array_i1 and gfc_array_i2. * generated/matmul_i1.c: New file. * generated/matmul_i2.c: New file. * generated/maxloc0_16_i1.c: New file. * generated/maxloc0_16_i2.c: New file. * generated/maxloc0_4_i1.c: New file. * generated/maxloc0_4_i2.c: New file. * generated/maxloc0_8_i1.c: New file. * generated/maxloc0_8_i2.c: New file. * generated/maxloc1_16_i1.c: New file. * generated/maxloc1_16_i2.c: New file. * generated/maxloc1_4_i1.c: New file. * generated/maxloc1_4_i2.c: New file. * generated/maxloc1_8_i1.c: New file. * generated/maxloc1_8_i2.c: New file. * generated/maxval_i1.c: New file. * generated/maxval_i2.c: New file. * generated/minloc0_16_i1.c: New file. * generated/minloc0_16_i2.c: New file. * generated/minloc0_4_i1.c: New file. * generated/minloc0_4_i2.c: New file. * generated/minloc0_8_i1.c: New file. * generated/minloc0_8_i2.c: New file. * generated/minloc1_16_i1.c: New file. * generated/minloc1_16_i2.c: New file. * generated/minloc1_4_i1.c: New file. * generated/minloc1_4_i2.c: New file. * generated/minloc1_8_i1.c: New file. * generated/minloc1_8_i2.c: New file. * generated/minval_i1.c: New file. * generated/minval_i2.c: New file. * generated/product_i1.c: New file. * generated/product_i2.c: New file. * generated/sum_i1.c: New file. * generated/sum_i2.c: New file. 2007-02-19 Thomas Koenig [EMAIL PROTECTED] PR libfortran/30533 * fortran/iresolve.c(gfc_resolve_maxloc): Remove coercion of argument to default integer. (gfc_resolve_minloc): Likewise. 2007-02-19 Thomas Koenig [EMAIL PROTECTED] PR libfortran/30533 * gfortran.dg/intrinsic_intkinds_1.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/intrinsic_intkinds_1.f90 trunk/libgfortran/generated/matmul_i1.c trunk/libgfortran/generated/matmul_i2.c trunk/libgfortran/generated/maxloc0_16_i1.c trunk/libgfortran/generated/maxloc0_16_i2.c trunk/libgfortran/generated/maxloc0_4_i1.c trunk/libgfortran/generated/maxloc0_4_i2.c trunk/libgfortran/generated/maxloc0_8_i1.c trunk/libgfortran/generated/maxloc0_8_i2.c trunk/libgfortran/generated/maxloc1_16_i1.c trunk/libgfortran/generated/maxloc1_16_i2.c trunk/libgfortran/generated/maxloc1_4_i1.c trunk/libgfortran/generated/maxloc1_4_i2.c trunk/libgfortran/generated/maxloc1_8_i1.c trunk/libgfortran/generated/maxloc1_8_i2.c trunk/libgfortran/generated/maxval_i1.c trunk/libgfortran/generated/maxval_i2.c trunk/libgfortran/generated/minloc0_16_i1.c trunk/libgfortran/generated/minloc0_16_i2.c trunk/libgfortran/generated/minloc0_4_i1.c trunk/libgfortran/generated/minloc0_4_i2.c trunk/libgfortran/generated/minloc0_8_i1.c trunk/libgfortran/generated/minloc0_8_i2.c trunk/libgfortran/generated/minloc1_16_i1.c trunk/libgfortran/generated/minloc1_16_i2.c trunk/libgfortran/generated/minloc1_4_i1.c trunk/libgfortran/generated/minloc1_4_i2.c trunk/libgfortran/generated/minloc1_8_i1.c trunk/libgfortran/generated/minloc1_8_i2.c trunk/libgfortran/generated/minval_i1.c trunk/libgfortran/generated/minval_i2.c trunk/libgfortran/generated/product_i1.c trunk/libgfortran/generated/product_i2.c
[Bug libfortran/30533] minval, maxval missing for kind=1 and kind=2
--- Comment #8 from tkoenig at gcc dot gnu dot org 2007-02-12 20:21 --- Created an attachment (id=13044) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13044action=view) combined patch for this and PR 30765 Regression-test is OK, file generation is OK. -- tkoenig at gcc dot gnu dot org changed: What|Removed |Added Attachment #13036|0 |1 is obsolete|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30533
[Bug libfortran/30533] minval, maxval missing for kind=1 and kind=2
--- Comment #9 from tkoenig at gcc dot gnu dot org 2007-02-12 20:23 --- Created an attachment (id=13045) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13045action=view) Test case Test case. I'll be away for a few days, I'll submit it as a proper patch then. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30533
[Bug libfortran/30533] minval, maxval missing for kind=1 and kind=2
--- Comment #10 from tkoenig at gcc dot gnu dot org 2007-02-12 20:25 --- (In reply to comment #8) Created an attachment (id=13044) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13044action=view) [edit] combined patch for this and PR 30765 Regression-test is OK, file generation is OK. I found and fixed the typo for i_any_c, it's a wonder this didn't break anything. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30533
[Bug libfortran/30533] minval, maxval missing for kind=1 and kind=2
--- Comment #7 from tkoenig at gcc dot gnu dot org 2007-02-11 19:42 --- Created an attachment (id=13036) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13036action=view) patch This fixes the missing intrinsics, and removes type conversion from minloc. This also reverses http://gcc.gnu.org/ml/gcc-cvs/2007-02/msg00353.html (PR 30765). -- tkoenig at gcc dot gnu dot org changed: What|Removed |Added Attachment #12990|0 |1 is obsolete|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30533
[Bug libfortran/30533] minval, maxval missing for kind=1 and kind=2
--- Comment #6 from tkoenig at gcc dot gnu dot org 2007-02-10 19:57 --- sum is also missing: $ cat sum.f90 program main integer(kind=1), dimension(2,2) :: a a = 1 print *,sum(a,dim=2) end program main $ gfortran sum.f90 /tmp/ccQgrJa3.o: In function `MAIN__': sum.f90:(.text+0x126): undefined reference to `_gfortran_sum_i1' collect2: ld returned 1 exit status -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30533
[Bug libfortran/30533] minval, maxval missing for kind=1 and kind=2
--- Comment #4 from fxcoudert at gcc dot gnu dot org 2007-02-07 08:09 --- (In reply to comment #3) I'm not yet sure how to deal with matmul, wether by converting its arguments or by creating kind=1 and kind=2 versions. I think converting wil have a huge performance hit, so we'd better havec kind=1 and kind=2 versions. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30533
[Bug libfortran/30533] minval, maxval missing for kind=1 and kind=2
--- Comment #5 from tkoenig at gcc dot gnu dot org 2007-02-07 20:08 --- I think converting wil have a huge performance hit, so we'd better havec kind=1 and kind=2 versions. I agree, here's a patch to do this. For speed reasons, we should also reverse the conversions through the intrinsics that only make one pass through the data (such as sum, product, or minmaxloc). Index: Makefile.am === --- Makefile.am (revision 121423) +++ Makefile.am (working copy) @@ -176,6 +176,8 @@ generated/maxloc1_8_r16.c \ generated/maxloc1_16_r16.c i_maxval_c= \ +generated/maxval_i1.c \ +generated/maxval_i2.c \ generated/maxval_i4.c \ generated/maxval_i8.c \ generated/maxval_i16.c \ @@ -231,6 +233,8 @@ generated/minloc1_8_r16.c \ generated/minloc1_16_r16.c i_minval_c= \ +generated/minval_i1.c \ +generated/minval_i2.c \ generated/minval_i4.c \ generated/minval_i8.c \ generated/minval_i16.c \ Index: libgfortran.h === --- libgfortran.h (revision 121423) +++ libgfortran.h (working copy) @@ -224,6 +224,10 @@ internal_proto(l8_to_l4_offset); #define GFOR_POINTER_L8_TO_L4(p8) \ (l8_to_l4_offset + (GFC_LOGICAL_4 *)(p8)) +#define GFC_INTEGER_1_HUGE \ + (GFC_INTEGER_1)GFC_UINTEGER_1)1) 7) - 1) +#define GFC_INTEGER_2_HUGE \ + (GFC_INTEGER_1)GFC_UINTEGER_1)1) 15) - 1) #define GFC_INTEGER_4_HUGE \ (GFC_INTEGER_4)GFC_UINTEGER_4)1) 31) - 1) #define GFC_INTEGER_8_HUGE \ @@ -283,6 +287,8 @@ struct {\ /* Commonly used array descriptor types. */ typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, void) gfc_array_void; typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, char) gfc_array_char; +typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_1) gfc_array_i1; +typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_2) gfc_array_i2; typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_4) gfc_array_i4; typedef GFC_ARRAY_DESCRIPTOR (GFC_MAX_DIMENSIONS, GFC_INTEGER_8) gfc_array_i8; #ifdef HAVE_GFC_INTEGER_16 -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30533
[Bug libfortran/30533] minval, maxval missing for kind=1 and kind=2
--- Comment #3 from tkoenig at gcc dot gnu dot org 2007-01-31 21:07 --- Created an attachment (id=12990) -- (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12990action=view) patch for minval and maxval Here's a solution for minval and maxval. I'm not yet sure how to deal with matmul, wether by converting its arguments or by creating kind=1 and kind=2 versions. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30533
[Bug libfortran/30533] minval, maxval missing for kind=1 and kind=2
--- Comment #2 from tkoenig at gcc dot gnu dot org 2007-01-29 22:42 --- For maxval, the usual method of converting the arguments to default integer kind will have an interesting side effect with an all-false mask: The value will be a conversion of the default integer minimum value (soon to be 0x80 after the fix for PR 30512 goes in) to kind=1 or kind=2. Definitely not recommended (this will probably be 0x00 or 0x)l The best solution is to generate new maxval_i[12].c files, which will be better for performance anyway. -- tkoenig at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |tkoenig at gcc dot gnu dot |dot org |org Status|NEW |ASSIGNED Last reconfirmed|2007-01-23 13:26:59 |2007-01-29 22:42:14 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30533
[Bug libfortran/30533] minval, maxval missing for kind=1 and kind=2
--- Comment #1 from fxcoudert at gcc dot gnu dot org 2007-01-23 13:26 --- matmul also has this problem: $ cat a.f90 integer(kind=1) :: x(2,2), y(2,2), i integer :: z(2,2) print *, matmul(x,y) !pack !unpack print *, maxval(x,dim=2), minval(x,dim=2) print *, (1.2,0.2)**i print *, sum(x), product(y) y = transpose(x) y = transpose(z) end $ gfortran a.f90 /tmp/ccWGjYiw.o: In function `MAIN__': a.f90:(.text+0x139): undefined reference to `_gfortran_matmul_i1' a.f90:(.text+0x2ba): undefined reference to `_gfortran_maxval_i1' a.f90:(.text+0x39d): undefined reference to `_gfortran_minval_i1' collect2: ld returned 1 exit status -- fxcoudert at gcc dot gnu dot org changed: What|Removed |Added Last reconfirmed|2007-01-22 21:30:39 |2007-01-23 13:26:59 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30533
[Bug libfortran/30533] minval, maxval missing for kind=1 and kind=2
-- fxcoudert at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2007-01-22 21:30:39 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30533