aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/check.c
diff options
context:
space:
mode:
authorFrancois-Xavier Coudert <coudert@clipper.ens.fr>2005-11-27 15:01:36 +0100
committerFrançois-Xavier Coudert <fxcoudert@gcc.gnu.org>2005-11-27 14:01:36 +0000
commit991bb832494d3e422ef703e317cd0dc21ab74ac3 (patch)
treec6f3cbda99666c39f12216bd3f642f6df5fcb01c /gcc/fortran/check.c
parentb604fe9b84e41f387222758a300dce02a39a6b1b (diff)
downloadgcc-991bb832494d3e422ef703e317cd0dc21ab74ac3.zip
gcc-991bb832494d3e422ef703e317cd0dc21ab74ac3.tar.gz
gcc-991bb832494d3e422ef703e317cd0dc21ab74ac3.tar.bz2
re PR fortran/23912 (MOD function requires same kind arguments)
PR fortran/23912 * iresolve.c (gfc_resolve_dim, gfc_resolve_mod, gfc_resolve_modulo): When arguments have different kinds, fold the lower one to the largest kind. * check.c (gfc_check_a_p): Arguments of different kinds is not a hard error, but an extension. * simplify.c (gfc_simplify_dim, gfc_simplify_mod, gfc_simplify_modulo): When arguments have different kinds, fold the lower one to the largest kind. * gfortran.dg/modulo_1.f90: New test. From-SVN: r107566
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r--gcc/fortran/check.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index bc757ff..7b71896 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -450,8 +450,21 @@ gfc_check_a_p (gfc_expr * a, gfc_expr * p)
if (int_or_real_check (a, 0) == FAILURE)
return FAILURE;
- if (same_type_check (a, 0, p, 1) == FAILURE)
- return FAILURE;
+ if (a->ts.type != p->ts.type)
+ {
+ gfc_error ("'%s' and '%s' arguments of '%s' intrinsic at %L must "
+ "have the same type", gfc_current_intrinsic_arg[0],
+ gfc_current_intrinsic_arg[1], gfc_current_intrinsic,
+ &p->where);
+ return FAILURE;
+ }
+
+ if (a->ts.kind != p->ts.kind)
+ {
+ if (gfc_notify_std (GFC_STD_GNU, "Extension: Different type kinds at %L",
+ &p->where) == FAILURE)
+ return FAILURE;
+ }
return SUCCESS;
}