From bf3fb7e43c8d1f22edda0c427a2ac194e8db104b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois-Xavier=20Coudert?= Date: Wed, 26 Jul 2006 11:58:48 +0000 Subject: intrinsic.c (add_functions): Add INT2, SHORT, INT8, LONG, LSTAT, MCLOCK and MCLOCK8 intrinsic functions. * intrinsic.c (add_functions): Add INT2, SHORT, INT8, LONG, LSTAT, MCLOCK and MCLOCK8 intrinsic functions. (add_subroutines): Add LSTAT intrinsic subroutine. * gfortran.h (gfc_generic_isym_id): Add GFC_ISYM_INT2, GFC_ISYM_INT8, GFC_ISYM_LONG, GFC_ISYM_LSTAT, GFC_ISYM_MCLOCK and GFC_ISYM_MCLOCK8. * iresolve.c (gfc_resolve_int2, gfc_resolve_int8, gfc_resolve_long, gfc_resolve_lstat, gfc_resolve_mclock, gfc_resolve_mclock8, gfc_resolve_lstat_sub): New functions. * check.c (gfc_check_intconv): New function. * trans-intrinsic.c (gfc_conv_intrinsic_function): Add cases for the added GFC_ISYM_*. * simplify.c (gfc_simplify_intconv, gfc_simplify_int2, gfc_simplify_int8, gfc_simplify_long): New functions. * intrinsic.h (gfc_check_intconv, gfc_simplify_int2, gfc_simplify_int8, gfc_simplify_long, gfc_resolve_int2, gfc_resolve_int8, gfc_resolve_long, gfc_resolve_lstat, gfc_resolve_mclock, gfc_resolve_mclock8, gfc_resolve_lstat_sub): Add prototypes. * gfortran.dg/mclock.f90: New test. * gfortran.dg/int_conv_1.f90: New test. * gfortran.dg/stat_1.f90: New test. * gfortran.dg/stat_2.f90: New test. * configure.ac: Check for function clock. * Makefile.am: Compile new file intrinsics/clock.c. * intrinsics/clock.c: New file. * Makefile.in: Regenerate. * configure: Regenerate. * config.h.in: Regenerate. * intrinsics/stat.c: Rename the old stat_i?_sub functions to helper functions stat_i?_sub_0, and use them for both STAT and LSTAT. From-SVN: r115754 --- gcc/fortran/iresolve.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) (limited to 'gcc/fortran/iresolve.c') diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index 3eeebc7..a65992e 100644 --- a/gcc/fortran/iresolve.c +++ b/gcc/fortran/iresolve.c @@ -854,6 +854,42 @@ gfc_resolve_int (gfc_expr * f, gfc_expr * a, gfc_expr * kind) void +gfc_resolve_int2 (gfc_expr * f, gfc_expr * a) +{ + f->ts.type = BT_INTEGER; + f->ts.kind = 2; + + f->value.function.name = + gfc_get_string ("__int_%d_%c%d", f->ts.kind, gfc_type_letter (a->ts.type), + a->ts.kind); +} + + +void +gfc_resolve_int8 (gfc_expr * f, gfc_expr * a) +{ + f->ts.type = BT_INTEGER; + f->ts.kind = 8; + + f->value.function.name = + gfc_get_string ("__int_%d_%c%d", f->ts.kind, gfc_type_letter (a->ts.type), + a->ts.kind); +} + + +void +gfc_resolve_long (gfc_expr * f, gfc_expr * a) +{ + f->ts.type = BT_INTEGER; + f->ts.kind = 4; + + f->value.function.name = + gfc_get_string ("__int_%d_%c%d", f->ts.kind, gfc_type_letter (a->ts.type), + a->ts.kind); +} + + +void gfc_resolve_isatty (gfc_expr * f, gfc_expr * u) { gfc_typespec ts; @@ -1191,6 +1227,24 @@ gfc_resolve_maxval (gfc_expr * f, gfc_expr * array, gfc_expr * dim, void +gfc_resolve_mclock (gfc_expr * f) +{ + f->ts.type = BT_INTEGER; + f->ts.kind = 4; + f->value.function.name = PREFIX("mclock"); +} + + +void +gfc_resolve_mclock8 (gfc_expr * f) +{ + f->ts.type = BT_INTEGER; + f->ts.kind = 8; + f->value.function.name = PREFIX("mclock8"); +} + + +void gfc_resolve_merge (gfc_expr * f, gfc_expr * tsource, gfc_expr * fsource ATTRIBUTE_UNUSED, gfc_expr * mask ATTRIBUTE_UNUSED) @@ -1804,6 +1858,16 @@ gfc_resolve_stat (gfc_expr * f, gfc_expr * n ATTRIBUTE_UNUSED, void +gfc_resolve_lstat (gfc_expr * f, gfc_expr * n ATTRIBUTE_UNUSED, + gfc_expr * a ATTRIBUTE_UNUSED) +{ + f->ts.type = BT_INTEGER; + f->ts.kind = gfc_default_integer_kind; + f->value.function.name = gfc_get_string (PREFIX("lstat_i%d"), f->ts.kind); +} + + +void gfc_resolve_fstat (gfc_expr * f, gfc_expr * n, gfc_expr * a ATTRIBUTE_UNUSED) { f->ts.type = BT_INTEGER; @@ -2656,6 +2720,16 @@ gfc_resolve_stat_sub (gfc_code * c) void +gfc_resolve_lstat_sub (gfc_code * c) +{ + const char *name; + + name = gfc_get_string (PREFIX("lstat_i%d_sub"), gfc_default_integer_kind); + c->resolved_sym = gfc_get_intrinsic_sub_symbol (name); +} + + +void gfc_resolve_fstat_sub (gfc_code * c) { const char *name; -- cgit v1.1