aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/iresolve.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2007-08-04 16:48:50 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2007-08-04 16:48:50 +0000
commit26ef8a2cd2252052953cce299ff5cc9e572d3996 (patch)
tree0111d3542f00aaafab8c5cb4301633729cea4bb9 /gcc/fortran/iresolve.c
parentf06a83c0b2f7761510836194a6c9a8a72000937c (diff)
downloadgcc-26ef8a2cd2252052953cce299ff5cc9e572d3996.zip
gcc-26ef8a2cd2252052953cce299ff5cc9e572d3996.tar.gz
gcc-26ef8a2cd2252052953cce299ff5cc9e572d3996.tar.bz2
re PR fortran/32968 (selected_(int|real)_kind fail with -fdefault-integer-8)
2008-08-04 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/32968 * gfortran.dg/selected_kind_1.f90: New test. 2008-08-04 Steven G. Kargl <kargl@gcc.gnu.org> 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. From-SVN: r127205
Diffstat (limited to 'gcc/fortran/iresolve.c')
-rw-r--r--gcc/fortran/iresolve.c32
1 files changed, 29 insertions, 3 deletions
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index 32ed6da..5c49135 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;