summaryrefslogtreecommitdiff
path: root/gcc/fortran/iresolve.c
diff options
context:
space:
mode:
authorburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-21 10:12:53 +0000
committerburnus <burnus@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-21 10:12:53 +0000
commitfaa9fea4b75802d498535ffbb350933c69d33257 (patch)
treef963b78e966a67d516f6105c26a4b775d5c2dcfd /gcc/fortran/iresolve.c
parent1e3aebecb9ca632bec0e31e580d41bbee3a20083 (diff)
downloadgcc-faa9fea4b75802d498535ffbb350933c69d33257.tar.gz
2010-08-21 Tobias Burnus <burnus@net-b.de>
PR fortran/36158 PR fortran/33197 * intrinsic.c (add_sym): Init value attribute. (set_attr_value): New function. (add_functions) Use it and add JN/YN resolvers. * symbol.c (gfc_copy_formal_args_intr): Copy value attr. * intrinsic.h (gfc_resolve_bessel_n2): New prototype. * gfortran.h (gfc_intrinsic_arg): Add value attribute. * iresolve.c (gfc_resolve_bessel_n2): New function. * trans-intrinsic.c (gfc_get_symbol_for_expr): Create formal arg list. (gfc_conv_intrinsic_function,gfc_is_intrinsic_libcall): Add GFC_ISYM_JN2/GFC_ISYM_YN2 as case value. * simplify.c (): For YN set to -INF if previous values was -INF. * trans-expr.c (gfc_conv_procedure_call): Don't crash if sym->as is NULL. * iresolve.c (gfc_resolve_extends_type_of): Set the type of the dummy argument to the one of the actual. 2010-08-21 Tobias Burnus <burnus@net-b.de> PR fortran/36158 PR fortran/33197 * m4/bessel.m4: Implement bessel_jn and bessel_yn. * gfortran.map: Add the generated bessel_jn_r{4,8,10,16} and bessel_yn_r{4,8,10,16}. * Makefile.am: Add bessel.m4. * Makefile.in: Regenerated. * generated/bessel_r4.c: Generated. * generated/bessel_r16.c: Generated. * generated/bessel_r8.c: Generated. * generated/bessel_r10.c: Generated. 2010-08-21 Tobias Burnus <burnus@net-b.de> PR fortran/36158 PR fortran/33197 * gfortran.dg/bessel_6.f90: New. * gfortran.dg/bessel_7.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163440 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/iresolve.c')
-rw-r--r--gcc/fortran/iresolve.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c
index 9bf767dbaf6..6565187423e 100644
--- a/gcc/fortran/iresolve.c
+++ b/gcc/fortran/iresolve.c
@@ -416,6 +416,45 @@ gfc_resolve_besn (gfc_expr *f, gfc_expr *n, gfc_expr *x)
void
+gfc_resolve_bessel_n2 (gfc_expr *f, gfc_expr *n1, gfc_expr *n2, gfc_expr *x)
+{
+ gfc_typespec ts;
+ gfc_clear_ts (&ts);
+
+ f->ts = x->ts;
+ f->rank = 1;
+ if (n1->expr_type == EXPR_CONSTANT && n2->expr_type == EXPR_CONSTANT)
+ {
+ f->shape = gfc_get_shape (1);
+ mpz_init (f->shape[0]);
+ mpz_sub (f->shape[0], n2->value.integer, n1->value.integer);
+ mpz_add_ui (f->shape[0], f->shape[0], 1);
+ }
+
+ if (n1->ts.kind != gfc_c_int_kind)
+ {
+ ts.type = BT_INTEGER;
+ ts.kind = gfc_c_int_kind;
+ gfc_convert_type (n1, &ts, 2);
+ }
+
+ if (n2->ts.kind != gfc_c_int_kind)
+ {
+ ts.type = BT_INTEGER;
+ ts.kind = gfc_c_int_kind;
+ gfc_convert_type (n2, &ts, 2);
+ }
+
+ if (f->value.function.isym->id == GFC_ISYM_JN2)
+ f->value.function.name = gfc_get_string (PREFIX ("bessel_jn_r%d"),
+ f->ts.kind);
+ else
+ f->value.function.name = gfc_get_string (PREFIX ("bessel_yn_r%d"),
+ f->ts.kind);
+}
+
+
+void
gfc_resolve_btest (gfc_expr *f, gfc_expr *i, gfc_expr *pos)
{
f->ts.type = BT_LOGICAL;
@@ -883,6 +922,10 @@ gfc_resolve_extends_type_of (gfc_expr *f, gfc_expr *a, gfc_expr *mo)
f->ts.type = BT_LOGICAL;
f->ts.kind = 4;
+
+ f->value.function.isym->formal->ts = a->ts;
+ f->value.function.isym->formal->next->ts = mo->ts;
+
/* Call library function. */
f->value.function.name = gfc_get_string (PREFIX ("is_extension_of"));
}