diff options
author | Francois-Xavier Coudert <coudert@clipper.ens.fr> | 2005-10-30 13:17:48 +0100 |
---|---|---|
committer | François-Xavier Coudert <fxcoudert@gcc.gnu.org> | 2005-10-30 12:17:48 +0000 |
commit | 0d519038a0354f983534037fd9a7d460421e4fd0 (patch) | |
tree | 74008967faaa4d2ec3fb686ef0f09df588ecbd88 /gcc/fortran/iresolve.c | |
parent | cf6ae9554d33bc2afe113135a0f34d5022bb1972 (diff) | |
download | gcc-0d519038a0354f983534037fd9a7d460421e4fd0.zip gcc-0d519038a0354f983534037fd9a7d460421e4fd0.tar.gz gcc-0d519038a0354f983534037fd9a7d460421e4fd0.tar.bz2 |
check.c (gfc_check_malloc, [...]): New functions.
* check.c (gfc_check_malloc, gfc_check_free): New functions.
* gfortran.h (gfc_generic_isym_id): Add GFC_ISYM_MALLOC.
* intrinsic.c (add_functions): Add symbols for MALLOC function.
(add_subroutines): Add symbol for FREE subroutine.
* intrinsic.h: Prototypes for gfc_check_malloc, gfc_check_free,
gfc_resolve_malloc and gfc_resolve_free.
* intrinsic.texi: Add doc for FREE and MALLOC intrinsics.
* iresolve.c (gfc_resolve_malloc, gfc_resolve_free): New
functions.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Add case for
GFC_ISYM_MALLOC.
* Makefile.am: Add intrinsics/malloc.c file.
* Makefile.in: Regenerate.
* intrinsics/malloc.c: New file, with implementations for free
and malloc library functions.
* gfortran.dg/malloc_free_1.f90: New test.
From-SVN: r106016
Diffstat (limited to 'gcc/fortran/iresolve.c')
-rw-r--r-- | gcc/fortran/iresolve.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index ae55aa7..5650c0f 100644 --- a/gcc/fortran/iresolve.c +++ b/gcc/fortran/iresolve.c @@ -912,6 +912,24 @@ gfc_resolve_logical (gfc_expr * f, gfc_expr * a, gfc_expr * kind) void +gfc_resolve_malloc (gfc_expr * f, gfc_expr * size) +{ + if (size->ts.kind < gfc_index_integer_kind) + { + gfc_typespec ts; + + ts.type = BT_INTEGER; + ts.kind = gfc_index_integer_kind; + gfc_convert_type_warn (size, &ts, 2, 0); + } + + f->ts.type = BT_INTEGER; + f->ts.kind = gfc_index_integer_kind; + f->value.function.name = gfc_get_string (PREFIX("malloc")); +} + + +void gfc_resolve_matmul (gfc_expr * f, gfc_expr * a, gfc_expr * b) { gfc_expr temp; @@ -2080,6 +2098,22 @@ gfc_resolve_flush (gfc_code * c) void +gfc_resolve_free (gfc_code * c) +{ + gfc_typespec ts; + gfc_expr *n; + + ts.type = BT_INTEGER; + ts.kind = gfc_index_integer_kind; + n = c->ext.actual->expr; + if (n->ts.kind != ts.kind) + gfc_convert_type (n, &ts, 2); + + c->resolved_sym = gfc_get_intrinsic_sub_symbol (PREFIX("free")); +} + + +void gfc_resolve_gerror (gfc_code * c) { c->resolved_sym = gfc_get_intrinsic_sub_symbol (PREFIX ("gerror")); |