summaryrefslogtreecommitdiff
path: root/gcc/fortran/iresolve.c
diff options
context:
space:
mode:
authortobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-11 11:06:31 +0000
committertobi <tobi@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-11 11:06:31 +0000
commit201e10b402dcaee58fc2dfd3bba7fcf580be5d97 (patch)
tree06e507cae1c1f5c6549e5c76d66fd6602bf4dc1e /gcc/fortran/iresolve.c
parentfe481547e2307fb7b60e0110177c2c73746ec590 (diff)
downloadgcc-201e10b402dcaee58fc2dfd3bba7fcf580be5d97.tar.gz
fortran/
PR fortran/17175 * iresolve.c (gfc_resolve_scale): Convert 'I' argument if not of same kind as C's 'int'. (gfc_resolve_set_eponent): Convert 'I' argument if not of kind 4. testsuite/ PR fortran/17175 * gfortran.dg/scale_1.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92029 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/iresolve.c')
-rw-r--r--gcc/fortran/iresolve.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index 687421b0b6c..7a4602872f1 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -1196,13 +1196,24 @@ gfc_resolve_rrspacing (gfc_expr * f, gfc_expr * x)
void
-gfc_resolve_scale (gfc_expr * f, gfc_expr * x,
- gfc_expr * y ATTRIBUTE_UNUSED)
+gfc_resolve_scale (gfc_expr * f, gfc_expr * x, gfc_expr * i)
{
f->ts = x->ts;
- f->value.function.name = gfc_get_string ("__scale_%d_%d", x->ts.kind,
- x->ts.kind);
+
+ /* The implementation calls scalbn which takes an int as the
+ second argument. */
+ if (i->ts.kind != gfc_c_int_kind)
+ {
+ gfc_typespec ts;
+
+ ts.type = BT_INTEGER;
+ ts.kind = gfc_default_integer_kind;
+
+ gfc_convert_type_warn (i, &ts, 2, 0);
+ }
+
+ f->value.function.name = gfc_get_string ("__scale_%d", x->ts.kind);
}
@@ -1223,8 +1234,21 @@ gfc_resolve_set_exponent (gfc_expr * f, gfc_expr * x, gfc_expr * i)
{
f->ts = x->ts;
- f->value.function.name =
- gfc_get_string ("__set_exponent_%d_%d", x->ts.kind, i->ts.kind);
+
+ /* The library implementation uses GFC_INTEGER_4 unconditionally,
+ convert type so we don't have to implment all possible
+ permutations. */
+ if (i->ts.kind != 4)
+ {
+ gfc_typespec ts;
+
+ ts.type = BT_INTEGER;
+ ts.kind = gfc_default_integer_kind;
+
+ gfc_convert_type_warn (i, &ts, 2, 0);
+ }
+
+ f->value.function.name = gfc_get_string ("__set_exponent_%d", x->ts.kind);
}