This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libfortran/30694] minval/maxval with +/-Inf



------- Comment #6 from fxcoudert at gcc dot gnu dot org  2007-02-06 12:12 -------
(In reply to comment #5)
> Min/maxval should return (for REAL):
>  +INF if there is an INF in the maxval argument array
>  -INF if there is a -INF in the minval argument array
>  NAN if the argument array only consists of NAN
>  -HUGE or HUGE if there the array is zero-dimensional (after masking)
> (for the other cases the obvious min/max values of the arguments)
> 
> For INTEGERs, we only have:
>  -HUGE-1 / +HUGE for a zero-dimensional array (after masking)
> (for the other cases the obvious min/max)
> as NAN and +/-INF don't exists (cf. PR30512).

I agree with that. I think we need separate m4 files for integers and reals,
changing the Makefile in the following way:

Index: Makefile.am
===================================================================
--- Makefile.am (revision 121506)
+++ Makefile.am (working copy)
@@ -175,10 +175,12 @@
 generated/maxloc1_8_r16.c \
 generated/maxloc1_16_r16.c

-i_maxval_c= \
+i_maxval_i_c= \
 generated/maxval_i4.c \
 generated/maxval_i8.c \
-generated/maxval_i16.c \
+generated/maxval_i16.c
+
+i_maxval_r_c= \
 generated/maxval_r4.c \
 generated/maxval_r8.c \
 generated/maxval_r10.c \
@@ -230,10 +232,12 @@
 generated/minloc1_8_r16.c \
 generated/minloc1_16_r16.c

-i_minval_c= \
+i_minval_i_c= \
 generated/minval_i4.c \
 generated/minval_i8.c \
-generated/minval_i16.c \
+generated/minval_i16.c
+
+i_minval_r_c= \
 generated/minval_r4.c \
 generated/minval_r8.c \
 generated/minval_r10.c \
@@ -419,9 +423,9 @@
 generated/pow_c16_i16.c

 m4_files= m4/iparm.m4 m4/ifunction.m4 m4/iforeach.m4 m4/all.m4 \
-    m4/any.m4 m4/count.m4 m4/maxloc0.m4 m4/maxloc1.m4 m4/maxval.m4 \
-    m4/minloc0.m4 m4/minloc1.m4 m4/minval.m4 m4/product.m4 m4/sum.m4 \
-    m4/matmul.m4 m4/matmull.m4 \
+    m4/any.m4 m4/count.m4 m4/maxloc0.m4 m4/maxloc1.m4 m4/maxval_i.m4 \
+    m4/maxval_r.m4 m4/minloc0.m4 m4/minloc1.m4 m4/minval_i.m4 m4/minval_r.m4 \
+    m4/product.m4 m4/sum.m4 m4/matmul.m4 m4/matmull.m4 \
     m4/ctrig.m4 m4/cexp.m4 m4/chyp.m4 m4/mtype.m4 \
     m4/specific.m4 m4/specific2.m4 m4/head.m4 m4/shape.m4 m4/reshape.m4 \
     m4/transpose.m4 m4/eoshift1.m4 m4/eoshift3.m4 m4/exponent
@@ -429,8 +433,8 @@
     m4/misc_specifics.m4 m4/rrspacing.m4 m4/spacing.m4

 gfor_built_src= $(i_all_c) $(i_any_c) $(i_count_c) $(i_maxloc0_c) \
-    $(i_maxloc1_c) $(i_maxval_c) $(i_minloc0_c) $(i_minloc1_c) $(i_minval_c) \
-    $(i_product_c) $(i_sum_c) \
+    $(i_maxloc1_c) $(i_maxval_i_c) $(i_maxval_r_c) $(i_minloc0_c) \
+    $(i_minloc1_c) $(i_minval_i_c) $(i_minval_r_c) $(i_product_c) $(i_sum_c) \
     $(i_matmul_c) $(i_matmull_c) $(i_transpose_c) $(i_shape_c) $(i_eoshift1_c) 
\
     $(i_eoshift3_c) $(i_cshift1_c) $(i_reshape_c) $(in_pack_c) $(in_unpack_c)
\
     $(i_exponent_c) $(i_fraction_c) $(i_nearest_c) $(i_set_exponent_c) \
@@ -647,18 +651,24 @@
 $(i_maxloc1_c): m4/maxloc1.m4 $(I_M4_DEPS1)
        $(M4) -Dfile=$@ -I$(srcdir)/m4 maxloc1.m4 > $(srcdir)/$@

-$(i_maxval_c): m4/maxval.m4 $(I_M4_DEPS1)
-       $(M4) -Dfile=$@ -I$(srcdir)/m4 maxval.m4 > $(srcdir)/$@
+$(i_maxval_i_c): m4/maxval_i.m4 $(I_M4_DEPS1)
+       $(M4) -Dfile=$@ -I$(srcdir)/m4 maxval_i.m4 > $(srcdir)/$@

+$(i_maxval_r_c): m4/maxval_r.m4 $(I_M4_DEPS1)
+       $(M4) -Dfile=$@ -I$(srcdir)/m4 maxval_r.m4 > $(srcdir)/$@
+
 $(i_minloc0_c): m4/minloc0.m4 $(I_M4_DEPS0)
        $(M4) -Dfile=$@ -I$(srcdir)/m4 minloc0.m4 > $(srcdir)/$@

 $(i_minloc1_c): m4/minloc1.m4 $(I_M4_DEPS1)
        $(M4) -Dfile=$@ -I$(srcdir)/m4 minloc1.m4 > $(srcdir)/$@

-$(i_minval_c): m4/minval.m4 $(I_M4_DEPS1)
-       $(M4) -Dfile=$@ -I$(srcdir)/m4 minval.m4 > $(srcdir)/$@
+$(i_minval_i_c): m4/minval_i.m4 $(I_M4_DEPS1)
+       $(M4) -Dfile=$@ -I$(srcdir)/m4 minval_i.m4 > $(srcdir)/$@

+$(i_minval_r_c): m4/minval_r.m4 $(I_M4_DEPS1)
+       $(M4) -Dfile=$@ -I$(srcdir)/m4 minval_r.m4 > $(srcdir)/$@
+
 $(i_product_c): m4/product.m4 $(I_M4_DEPS1)
        $(M4) -Dfile=$@ -I$(srcdir)/m4 product.m4 > $(srcdir)/$@


I don't know what the status is of the other patch for MAXVAL/MINVAL, but we
should probably combine them into a single patch (in particular to ease the
backporting).


-- 

fxcoudert at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|fortran                     |libfortran
   Last reconfirmed|2007-02-05 19:40:47         |2007-02-06 12:12:21
               date|                            |
   Target Milestone|---                         |4.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30694


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]