diff options
| author | pbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-17 15:34:12 +0000 |
|---|---|---|
| committer | pbrook <pbrook@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-08-17 15:34:12 +0000 |
| commit | 1b716045fc9e347b54af8e6c4b669dc8caff23b8 (patch) | |
| tree | 7d8312b4f1a046c12f0c41b27b061fef7c8e4adb /gcc/fortran/trans-array.c | |
| parent | fedc74634609e169ad14eba6fc05c8e32137cfc0 (diff) | |
| download | ppe42-gcc-1b716045fc9e347b54af8e6c4b669dc8caff23b8.tar.gz ppe42-gcc-1b716045fc9e347b54af8e6c4b669dc8caff23b8.zip | |
2004-08-17 Paul Brook <paul@codesourcery.com>
Tobias Schlueter <tobias.schlueter@physik.uni-muenchen.de>
PR fortran/13082
* decl.c (get_proc_name): Update mystery comment.
(gfc_match_entry): Check for errors earlier. Add entry point to list.
* dump-parse-tree.c (gfc_show_code_node): Print EXEC_ENTRY nodes.
* gfortran.h (symbol_attribute): Add entry_master. Document entry.
(struct gfc_entry_list): Define.
(gfc_get_entry_list): Define.
(struct gfc_namespace): Add refs and entries.
(enum gfc_exec_op): Add EXEC_ENTRY.
(struct gfc_code): Add ext.entry.
* module.c (ab_attribute, attr_bits): Remove AB_ENTRY.
(mio_symbol_attribute): Don't save/reture addr->entry.
(mio_namespace_ref): Refcount namespaces.
* parse.c (accept_statement): Handle ST_ENTRY.
(gfc_fixup_sibling_symbols): Mark symbol as referenced.
(parse_contained): Fixup sibling references to entry points
after parsing the procedure body.
* resolve.c (resolve_contained_fntype): New function.
(merge_argument_lists, resolve_entries): New functions.
(resolve_contained_functions): Use them.
(resolve_code): Handle EXEC_ENTRY.
(gfc_resolve): Call resolve_entries.
* st.c (gfc_free_statement): Handle EXEC_ENTRY.
* symbol.c (gfc_get_namespace): Refcount namespaces.
(gfc_free_namespace): Ditto.
* trans-array.c (gfc_trans_dummy_array_bias): Treat all args as
optional when multiple entry points are present.
* trans-decl.c (gfc_get_symbol_decl): Remove incorrect check.
(gfc_get_extern_function_decl): Add assertion. Fix coment.
(create_function_arglist, trans_function_start, build_entry_thunks):
New functions.
(gfc_build_function_decl): Rename ...
(build_function_decl): ... to this.
(gfc_create_function_decl): New function.
(gfc_generate_contained_functions): Use it.
(gfc_trans_entry_master_switch): New function.
(gfc_generate_function_code): Use new functions.
* trans-stmt.c (gfc_trans_entry): New function.
* trans-stmt.h (gfc_trans_entry): Add prototype.
* trans-types.c (gfc_get_function_type): Add entry point argument.
* trans.c (gfc_trans_code): Handle EXEC_ENTRY.
(gfc_generate_module_code): Call gfc_create_function_decl.
* trans.h (gfc_build_function_decl): Remove.
(gfc_create_function_decl): Add prototype.
testsuite/
* gfortran.dg/entry_1.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86128 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/trans-array.c')
| -rw-r--r-- | gcc/fortran/trans-array.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index a6dea46b9c0..3abb1959ebe 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -3074,6 +3074,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) int n; int checkparm; int no_repack; + bool optional_arg; /* Do nothing for pointer and allocatable arrays. */ if (sym->attr.pointer || sym->attr.allocatable) @@ -3281,7 +3282,8 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) /* Only do the entry/initialization code if the arg is present. */ dumdesc = GFC_DECL_SAVED_DESCRIPTOR (tmpdesc); - if (sym->attr.optional) + optional_arg = sym->attr.optional || sym->ns->proc_name->attr.entry_master; + if (optional_arg) { tmp = gfc_conv_expr_present (sym); stmt = build_v (COND_EXPR, tmp, stmt, build_empty_stmt ()); @@ -3318,7 +3320,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) tmp = build (NE_EXPR, boolean_type_node, tmp, tmpdesc); stmt = build_v (COND_EXPR, tmp, stmt, build_empty_stmt ()); - if (sym->attr.optional) + if (optional_arg) { tmp = gfc_conv_expr_present (sym); stmt = build_v (COND_EXPR, tmp, stmt, build_empty_stmt ()); |

