aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/check.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2005-01-29 17:46:34 +0000
committerPaul Brook <pbrook@gcc.gnu.org>2005-01-29 17:46:34 +0000
commit985aff9c177850b75e1684d42eaeaef06f86318b (patch)
tree4e5cd3273822f358db1e26f4e1b1abfde7234436 /gcc/fortran/check.c
parent46df282378908dff9219749cd4cd576c155b2971 (diff)
downloadgcc-985aff9c177850b75e1684d42eaeaef06f86318b.zip
gcc-985aff9c177850b75e1684d42eaeaef06f86318b.tar.gz
gcc-985aff9c177850b75e1684d42eaeaef06f86318b.tar.bz2
re PR fortran/18565 (gfortran: CONJG: false error message about standard violation)
2005-01-29 Paul Brook <paul@codesourcery.com> PR fortran/18565 * check.c (real_or_complex_check): New function. (gfc_check_fn_c, gfc_check_fn_r, gfc_check_fn_rc): New functions. * intrinsic.c (add_functions): Use new check functions. * intrinsic.h (gfc_check_fn_c, gfc_check_fn_r, gfc_check_fn_rc): Add prototypes. testsuite/ * gfortran.dg/double_complex_1.f90: New test. From-SVN: r94412
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r--gcc/fortran/check.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 7ce9da6..a63112b 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -88,6 +88,21 @@ int_or_real_check (gfc_expr * e, int n)
}
+/* Check that an expression is real or complex. */
+
+static try
+real_or_complex_check (gfc_expr * e, int n)
+{
+ if (e->ts.type != BT_REAL && e->ts.type != BT_COMPLEX)
+ {
+ must_be (e, n, "REAL or COMPLEX");
+ return FAILURE;
+ }
+
+ return SUCCESS;
+}
+
+
/* Check that the expression is an optional constant integer
and that it specifies a valid kind for that type. */
@@ -718,6 +733,42 @@ gfc_check_eoshift (gfc_expr * array, gfc_expr * shift, gfc_expr * boundary,
}
+/* A single complex argument. */
+
+try
+gfc_check_fn_c (gfc_expr * a)
+{
+ if (type_check (a, 0, BT_COMPLEX) == FAILURE)
+ return FAILURE;
+
+ return SUCCESS;
+}
+
+
+/* A single real argument. */
+
+try
+gfc_check_fn_r (gfc_expr * a)
+{
+ if (type_check (a, 0, BT_REAL) == FAILURE)
+ return FAILURE;
+
+ return SUCCESS;
+}
+
+
+/* A single real or complex argument. */
+
+try
+gfc_check_fn_rc (gfc_expr * a)
+{
+ if (real_or_complex_check (a, 0) == FAILURE)
+ return FAILURE;
+
+ return SUCCESS;
+}
+
+
try
gfc_check_fnum (gfc_expr * unit)
{