diff options
author | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-11 20:32:42 +0000 |
---|---|---|
committer | tkoenig <tkoenig@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-11 20:32:42 +0000 |
commit | 708069f0b3f596e28f53000712163c820fb3101c (patch) | |
tree | dd3320fb0f0e8dd37c2f392a040157b60b01bd81 /gcc/fortran/iresolve.c | |
parent | 886a341f3ff7c1a2dec9207e1a68d1ea18e50e73 (diff) | |
download | gcc-708069f0b3f596e28f53000712163c820fb3101c.tar.gz |
2007-01-11 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/30415
* iresolve.c (gfc_resolve_maxloc): If the rank
of the return array is nonzero and we process an
integer array smaller than default kind, coerce
the array to default integer.
* iresolve.c (gfc_resolve_minloc): Likewise.
2007-01-11 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/30415
* minmaxloc_integer_kinds_1.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120685 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/iresolve.c')
-rw-r--r-- | gcc/fortran/iresolve.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index 63741f2ba6f..4ded73d5307 100644 --- a/gcc/fortran/iresolve.c +++ b/gcc/fortran/iresolve.c @@ -1231,6 +1231,19 @@ gfc_resolve_maxloc (gfc_expr *f, gfc_expr *array, gfc_expr *dim, else name = "maxloc"; + /* If the rank of the function is nonzero, we are going to call + a library function. Coerce the argument to one of the + existing library functions for this case. */ + + if (f->rank != 0 && array->ts.type == BT_INTEGER + && array->ts.kind < gfc_default_integer_kind) + { + gfc_typespec ts; + ts.type = BT_INTEGER; + ts.kind = gfc_default_integer_kind; + gfc_convert_type_warn (array, &ts, 2, 0); + } + f->value.function.name = gfc_get_string (PREFIX ("%s%d_%d_%c%d"), name, dim != NULL, f->ts.kind, gfc_type_letter (array->ts.type), array->ts.kind); @@ -1385,6 +1398,19 @@ gfc_resolve_minloc (gfc_expr *f, gfc_expr *array, gfc_expr *dim, else name = "minloc"; + /* If the rank of the function is nonzero, we are going to call + a library function. Coerce the argument to one of the + existing library functions for this case. */ + + if (f->rank != 0 && array->ts.type == BT_INTEGER + && array->ts.kind < gfc_default_integer_kind) + { + gfc_typespec ts; + ts.type = BT_INTEGER; + ts.kind = gfc_default_integer_kind; + gfc_convert_type_warn (array, &ts, 2, 0); + } + f->value.function.name = gfc_get_string (PREFIX ("%s%d_%d_%c%d"), name, dim != NULL, f->ts.kind, gfc_type_letter (array->ts.type), array->ts.kind); |