This is the mail archive of the gcc-patches@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]

[gfortran] Minor cleanup to trans-intrinsic.c


This is a little cleanup to trans-intrinsic.c that I did while looking at how
we deal with rounding.

The code changes of this would qualify as obviously correct, but I would like
feedback if the wording I added to the comment, does indeed give it the
meaning that was originally intended.

Bubblestrapped, testing in progress. OK if it passes?

- Tobi

2004-12-20  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>

	* trans-intrinsic.c (build_fix_expr): Change 'op' argument
	to correct enum type.
	(gfc_conv_intrinsic_aint): Likewise.  Also correct comment in
	front of function.  Add default case to switch.

Index: trans-intrinsic.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/trans-intrinsic.c,v
retrieving revision 1.34
diff -u -p -r1.34 trans-intrinsic.c
--- trans-intrinsic.c   16 Dec 2004 19:10:18 -0000      1.34
+++ trans-intrinsic.c   20 Dec 2004 18:41:53 -0000
@@ -279,7 +279,8 @@ build_round_expr (stmtblock_t * pblock,
    however the RTL expander only actually supports FIX_TRUNC_EXPR.  */

 static tree
-build_fix_expr (stmtblock_t * pblock, tree arg, tree type, int op)
+build_fix_expr (stmtblock_t * pblock, tree arg,
+               tree type, enum tree_code op)
 {
   switch (op)
     {
@@ -302,14 +303,16 @@ build_fix_expr (stmtblock_t * pblock, tr

 /* Round a real value using the specified rounding mode.
    We use a temporary integer of that same kind size as the result.
-   Values larger than can be represented by this kind are unchanged, as
-   will not be accurate enough to represent the rounding.
+   Values larger than those that can be represented by this kind are
+   unchanged, as they will not be accurate enough to represent the
+   rounding.
     huge = HUGE (KIND (a))
     aint (a) = ((a > huge) || (a < -huge)) ? a : (real)(int)a
    */

 static void
-gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr, int op)
+gfc_conv_intrinsic_aint (gfc_se * se, gfc_expr * expr,
+                        enum tree_code op)
 {
   tree type;
   tree itype;
@@ -350,6 +353,10 @@ gfc_conv_intrinsic_aint (gfc_se * se, gf
          n = BUILT_IN_FLOOR;
          break;
        }
+      break;
+
+    default:
+      gcc_unreachable ();
     }

   /* Evaluate the argument.  */


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