]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
check.c (gfc_check_selected_int_kind): New function.
authorSteven G. Kargl <kargls@comcast.net>
Sat, 19 Feb 2005 20:29:05 +0000 (20:29 +0000)
committerSteven G. Kargl <kargl@gcc.gnu.org>
Sat, 19 Feb 2005 20:29:05 +0000 (20:29 +0000)
* check.c (gfc_check_selected_int_kind): New function.
* intrinsic.h: Prototype it.
* intrinsic.c (add_function): Use it.
* simplify (gfc_simplify_ceiling,gfc_simplify_floor): Change
  BT_REAL to BT_INTEGER and use gfc_default_integer_kind.

From-SVN: r95291

gcc/fortran/ChangeLog
gcc/fortran/check.c
gcc/fortran/intrinsic.c
gcc/fortran/intrinsic.h
gcc/fortran/simplify.c

index f4a36405f6a8a697c44ccf408112566e9796ff75..dea285b397cdbbe8b6a1bb768383c70f09f58632 100644 (file)
@@ -1,3 +1,11 @@
+2005-02-19  Steven G. Kargl  <kargls@comcast.net>
+  
+       * check.c (gfc_check_selected_int_kind): New function.
+       * intrinsic.h: Prototype it.
+       * intrinsic.c (add_function): Use it.
+       * simplify (gfc_simplify_ceiling,gfc_simplify_floor): Change
+         BT_REAL to BT_INTEGER and use gfc_default_integer_kind.
+
 2005-02-19  Steven G. Kargl  <kargls@comcast.net>
   
        * check.c (gfc_check_int): improve checking of optional kind
index 281db8885242a051944c629a6f7a0da85ad419c8..7986c968f9b9254cd4b1643070c2d5193c8f5047 100644 (file)
@@ -1553,6 +1553,20 @@ gfc_check_scan (gfc_expr * x, gfc_expr * y, gfc_expr * z)
 }
 
 
+try
+gfc_check_selected_int_kind (gfc_expr * r)
+{
+
+  if (type_check (r, 0, BT_INTEGER) == FAILURE)
+    return FAILURE;
+
+  if (scalar_check (r, 0) == FAILURE)
+    return FAILURE;
+
+  return SUCCESS;
+}
+
+
 try
 gfc_check_selected_real_kind (gfc_expr * p, gfc_expr * r)
 {
index 3c1b771c1a9b5ed981919be395f9c5fd06649eea..f28317ccd69e036071bd7a2c877a09efa7b8f3f1 100644 (file)
@@ -1781,7 +1781,7 @@ add_functions (void)
   make_generic ("second", GFC_ISYM_SECOND, GFC_STD_GNU);
 
   add_sym_1 ("selected_int_kind", 0, 1, BT_INTEGER, di,  GFC_STD_F95,
-            NULL, gfc_simplify_selected_int_kind, NULL,
+            gfc_check_selected_int_kind, gfc_simplify_selected_int_kind, NULL,
             r, BT_INTEGER, di, REQUIRED);
 
   make_generic ("selected_int_kind", GFC_ISYM_SI_KIND, GFC_STD_F95);
index 85f3a253e6cc20c164e8a524f7b579ea1e2665cf..686d179d5a509c9ee2ac4ff952ffd0b920545231 100644 (file)
@@ -94,6 +94,7 @@ try gfc_check_reshape (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *);
 try gfc_check_scale (gfc_expr *, gfc_expr *);
 try gfc_check_scan (gfc_expr *, gfc_expr *, gfc_expr *);
 try gfc_check_second_sub (gfc_expr *);
+try gfc_check_selected_int_kind (gfc_expr *);
 try gfc_check_selected_real_kind (gfc_expr *, gfc_expr *);
 try gfc_check_set_exponent (gfc_expr *, gfc_expr *);
 try gfc_check_shape (gfc_expr *);
index 0290b8463706697086db5a6fc5f4c877c93035f9..81bc01599091420a7c4999a1307c1f18246226af 100644 (file)
@@ -592,7 +592,7 @@ gfc_simplify_ceiling (gfc_expr * e, gfc_expr * k)
   gfc_expr *ceil, *result;
   int kind;
 
-  kind = get_kind (BT_REAL, k, "CEILING", gfc_default_real_kind);
+  kind = get_kind (BT_INTEGER, k, "CEILING", gfc_default_integer_kind);
   if (kind == -1)
     return &gfc_bad_expr;
 
@@ -1017,7 +1017,7 @@ gfc_simplify_floor (gfc_expr * e, gfc_expr * k)
   mpfr_t floor;
   int kind;
 
-  kind = get_kind (BT_REAL, k, "FLOOR", gfc_default_real_kind);
+  kind = get_kind (BT_INTEGER, k, "FLOOR", gfc_default_integer_kind);
   if (kind == -1)
     gfc_internal_error ("gfc_simplify_floor(): Bad kind");