diff options
author | Thomas Koenig <Thomas.Koenig@online.de> | 2005-08-10 20:16:29 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2005-08-10 20:16:29 +0000 |
commit | bf30222095f87487f17327279fe563dff47479df (patch) | |
tree | 192d52eb31c60fbe56e1909dc928b0c43d08c0ca /gcc/fortran/resolve.c | |
parent | bb8df8a62d346532834194e96b8d3970eb8cd6e0 (diff) | |
download | gcc-bf30222095f87487f17327279fe563dff47479df.zip gcc-bf30222095f87487f17327279fe563dff47479df.tar.gz gcc-bf30222095f87487f17327279fe563dff47479df.tar.bz2 |
re PR libfortran/22143 (missing kinds 1 and 2 for eoshift and cshift)
2005-08-10 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/22143
gfortran.h: Declare new function gfc_resolve_dim_arg.
resolve.c: New function gfc_resolve_dim_arg.
iresolve.c (gfc_resolve_all): Use gfc_resolve_dim_arg.
(gfc_resolve_any): Likewise.
(gfc_resolve_count): Likewise.
(gfc_resolve_cshift): Likewise. If the kind of shift is less
gfc_default_integer_kind, convert it to default integer type.
(gfc_resolve_eoshift): Likewise.
(gfc_resolve_maxloc): Use gfc_resolve_dim_arg.
(gfc_resolve_maxval): Likewise.
(gfc_resolve_minloc): Likewise.
(gfc_resolve_minval): Likewise.
(gfc_resolve_product): Likewise.
(gfc_resolve_spread): Likewise.
(gfc_resolve_sum): Likewise.
2005-08-10 Thomas Koenig <Thomas.Koenig@online.de>
PR libfortran/22143
gfortran.dg/shift-kind.f90: New testcase.
From-SVN: r102957
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index d855a7f..ace5958 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1828,6 +1828,40 @@ gfc_resolve_index (gfc_expr * index, int check_scalar) return SUCCESS; } +/* Resolve a dim argument to an intrinsic function. */ + +try +gfc_resolve_dim_arg (gfc_expr *dim) +{ + if (dim == NULL) + return SUCCESS; + + if (gfc_resolve_expr (dim) == FAILURE) + return FAILURE; + + if (dim->rank != 0) + { + gfc_error ("Argument dim at %L must be scalar", &dim->where); + return FAILURE; + + } + if (dim->ts.type != BT_INTEGER) + { + gfc_error ("Argument dim at %L must be of INTEGER type", &dim->where); + return FAILURE; + } + if (dim->ts.kind != gfc_index_integer_kind) + { + gfc_typespec ts; + + ts.type = BT_INTEGER; + ts.kind = gfc_index_integer_kind; + + gfc_convert_type_warn (dim, &ts, 2, 0); + } + + return SUCCESS; +} /* Given an expression that contains array references, update those array references to point to the right array specifications. While this is |