From e2d2dbf98657c0b3459d5ea3965e309b13aaeb6f Mon Sep 17 00:00:00 2001 From: kargl Date: Sat, 4 Aug 2007 16:48:50 +0000 Subject: 2008-08-04 Steven G. Kargl PR fortran/32968 * gfortran.dg/selected_kind_1.f90: New test. 2008-08-04 Steven G. Kargl PR fortran/32969 * iresolve.c (gfc_resolve_rrspacing): Convert argument(s) to expected KIND. (gfc_resolve_scale): Ditto. (gfc_resolve_set_exponent): Ditto. (gfc_resolve_spacing): Ditto. PR fortran/32968 * trans-intrinsic.c (gfc_conv_intrinsic_si_kind, gfc_conv_intrinsic_sr_kind): Convert the argument(s) to the expected KIND, and fold the result to the expected KIND. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127205 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/iresolve.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'gcc/fortran/iresolve.c') diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index 32ed6da5645..5c491355908 100644 --- a/gcc/fortran/iresolve.c +++ b/gcc/fortran/iresolve.c @@ -1742,6 +1742,14 @@ gfc_resolve_rrspacing (gfc_expr *f, gfc_expr *x) prec = gfc_get_actual_arglist (); prec->name = "p"; prec->expr = gfc_int_expr (gfc_real_kinds[k].digits); + /* The library routine expects INTEGER(4). */ + if (prec->expr->ts.kind != gfc_c_int_kind) + { + gfc_typespec ts; + ts.type = BT_INTEGER; + ts.kind = gfc_c_int_kind; + gfc_convert_type (prec->expr, &ts, 2); + } f->value.function.actual->next = prec; } @@ -1757,7 +1765,7 @@ gfc_resolve_scale (gfc_expr *f, gfc_expr *x, gfc_expr *i) { gfc_typespec ts; ts.type = BT_INTEGER; - ts.kind = gfc_default_integer_kind; + ts.kind = gfc_c_int_kind; gfc_convert_type_warn (i, &ts, 2, 0); } @@ -1792,11 +1800,11 @@ gfc_resolve_set_exponent (gfc_expr *f, gfc_expr *x, gfc_expr *i) /* The library implementation uses GFC_INTEGER_4 unconditionally, convert type so we don't have to implement all possible permutations. */ - if (i->ts.kind != 4) + if (i->ts.kind != gfc_c_int_kind) { gfc_typespec ts; ts.type = BT_INTEGER; - ts.kind = gfc_default_integer_kind; + ts.kind = gfc_c_int_kind; gfc_convert_type_warn (i, &ts, 2, 0); } @@ -1892,11 +1900,29 @@ gfc_resolve_spacing (gfc_expr *f, gfc_expr *x) emin_1 = gfc_get_actual_arglist (); emin_1->name = "emin"; emin_1->expr = gfc_int_expr (gfc_real_kinds[k].min_exponent - 1); + + /* The library routine expects INTEGER(4). */ + if (emin_1->expr->ts.kind != gfc_c_int_kind) + { + gfc_typespec ts; + ts.type = BT_INTEGER; + ts.kind = gfc_c_int_kind; + gfc_convert_type (emin_1->expr, &ts, 2); + } emin_1->next = tiny; prec = gfc_get_actual_arglist (); prec->name = "prec"; prec->expr = gfc_int_expr (gfc_real_kinds[k].digits); + + /* The library routine expects INTEGER(4). */ + if (prec->expr->ts.kind != gfc_c_int_kind) + { + gfc_typespec ts; + ts.type = BT_INTEGER; + ts.kind = gfc_c_int_kind; + gfc_convert_type (prec->expr, &ts, 2); + } prec->next = emin_1; f->value.function.actual->next = prec; -- cgit v1.2.1