aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/iresolve.c
diff options
context:
space:
mode:
authorSteven G. Kargl <kargls@comcast.net>2005-10-11 23:58:17 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2005-10-11 23:58:17 +0000
commit5dd17af5742b0774059332ae91579ad5ec19ef5f (patch)
treee3a513c7daef9eda904a926588a408a02d90ea77 /gcc/fortran/iresolve.c
parent4bbae09f178ab7f11dbb4469604f347f615f686e (diff)
downloadgcc-5dd17af5742b0774059332ae91579ad5ec19ef5f.zip
gcc-5dd17af5742b0774059332ae91579ad5ec19ef5f.tar.gz
gcc-5dd17af5742b0774059332ae91579ad5ec19ef5f.tar.bz2
re PR fortran/20786 (Can't use AINT intrinsic with KIND parameter)
PR fortran/20786 * iresolve.c (gfc_resolve_aint, gfc_resolve_anint ): Type conversion of the argument. gfortran.dg/aint_anint_1.f90: New test. From-SVN: r105276
Diffstat (limited to 'gcc/fortran/iresolve.c')
-rw-r--r--gcc/fortran/iresolve.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index 195f05e..6c23d4a 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -105,9 +105,17 @@ gfc_resolve_aimag (gfc_expr * f, gfc_expr * x)
void
gfc_resolve_aint (gfc_expr * f, gfc_expr * a, gfc_expr * kind)
{
+ gfc_typespec ts;
+
f->ts.type = a->ts.type;
f->ts.kind = (kind == NULL) ? a->ts.kind : mpz_get_si (kind->value.integer);
+ if (a->ts.kind != f->ts.kind)
+ {
+ ts.type = f->ts.type;
+ ts.kind = f->ts.kind;
+ gfc_convert_type (a, &ts, 2);
+ }
/* The resolved name is only used for specific intrinsics where
the return kind is the same as the arg kind. */
f->value.function.name =
@@ -143,9 +151,18 @@ gfc_resolve_all (gfc_expr * f, gfc_expr * mask, gfc_expr * dim)
void
gfc_resolve_anint (gfc_expr * f, gfc_expr * a, gfc_expr * kind)
{
+ gfc_typespec ts;
+
f->ts.type = a->ts.type;
f->ts.kind = (kind == NULL) ? a->ts.kind : mpz_get_si (kind->value.integer);
+ if (a->ts.kind != f->ts.kind)
+ {
+ ts.type = f->ts.type;
+ ts.kind = f->ts.kind;
+ gfc_convert_type (a, &ts, 2);
+ }
+
/* The resolved name is only used for specific intrinsics where
the return kind is the same as the arg kind. */
f->value.function.name =