Commit 49e4d580 by Tobias Schlüter Committed by Tobias Schlüter

re PR fortran/17175 (set_exponent breaks with integer*8 exponent)

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.

From-SVN: r92029
parent b990f4bc
2004-12-10 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
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.
2004-12-08 Richard Henderson <rth@redhat.com>
* intrinsic.c (gfc_convert_type_warn): Propagate the input shape
......
......@@ -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);
}
......
2004-12-11 Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/17175
* gfortran.dg/scale_1.f90: New test.
2004-12-10 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/18903
......
! { dg-do run }
! inspired by PR17175
REAL X
DOUBLE PRECISION Y
INTEGER, PARAMETER :: DP = KIND(Y)
INTEGER*1 I1
INTEGER*2 I2
INTEGER*4 I4
INTEGER*8 I8
X = 1.
Y = 1._DP
I1 = 10
I2 = -10
I4 = 20
I8 = -20
X = SCALE (X, I1)
X = SCALE (X, I2)
IF (X.NE.1.) CALL ABORT()
X = SCALE (X, I4)
X = SCALE (X, I8)
IF (X.NE.1.) CALL ABORT()
Y = SCALE (Y, I1)
Y = SCALE (Y, I2)
IF (Y.NE.1._DP) CALL ABORT()
Y = SCALE (Y, I4)
Y = SCALE (Y, I8)
IF (Y.NE.1._DP) CALL ABORT()
END
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment