PING [gfortran] PATCH Fix ceiling, floor, and selected_int_kind intrinsics

Steve Kargl sgk@troutmask.apl.washington.edu
Fri Feb 11 14:37:00 GMT 2005


On Tue, Feb 01, 2005 at 12:37:39PM -0800, Steve Kargl wrote:
> The attach patch fixes the ceiling, floor, and selected_int_kind
> intrinsic procedures.  With this patch and the patches for int and
> achar, I can compile the following with and without -std=-f95.
> 
> http://home.comcast.net/~kmbtib/Fortran_stuff/test_intrinsic1.f90
> 
> 2005-02-01  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.
> 
> -- 
> Steve

> Index: check.c
> ===================================================================
> RCS file: /cvsroot/gcc/gcc/gcc/fortran/check.c,v
> retrieving revision 1.23
> diff -u -r1.23 check.c
> --- check.c	29 Jan 2005 17:46:30 -0000	1.23
> +++ check.c	1 Feb 2005 20:28:01 -0000
> @@ -1536,6 +1554,20 @@
>  
>  
>  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)
>  {
>    if (p == NULL && r == NULL)
> Index: intrinsic.c
> ===================================================================
> RCS file: /cvsroot/gcc/gcc/gcc/fortran/intrinsic.c,v
> retrieving revision 1.38
> diff -u -r1.38 intrinsic.c
> --- intrinsic.c	29 Jan 2005 17:46:31 -0000	1.38
> +++ intrinsic.c	1 Feb 2005 20:28:01 -0000
> @@ -1781,7 +1781,7 @@
>    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: intrinsic.h
> ===================================================================
> RCS file: /cvsroot/gcc/gcc/gcc/fortran/intrinsic.h,v
> retrieving revision 1.21
> diff -u -r1.21 intrinsic.h
> --- intrinsic.h	29 Jan 2005 17:46:31 -0000	1.21
> +++ intrinsic.h	1 Feb 2005 20:28:01 -0000
> @@ -93,6 +94,7 @@
>  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: simplify.c
> ===================================================================
> RCS file: /cvsroot/gcc/gcc/gcc/fortran/simplify.c,v
> retrieving revision 1.17
> diff -u -r1.17 simplify.c
> --- simplify.c	18 Jan 2005 12:11:54 -0000	1.17
> +++ simplify.c	1 Feb 2005 20:28:01 -0000
> @@ -592,7 +592,7 @@
>    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 @@
>    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");


-- 
Steve



More information about the Gcc-patches mailing list