aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
AgeCommit message (Collapse)AuthorFilesLines
2008-11-25module.c (gfc_dump_module): Report error on unlink only if errno != ENOENT.H.J. Lu1-1/+1
2008-11-25 H.J. Lu <hongjiu.lu@intel.com> * module.c (gfc_dump_module): Report error on unlink only if errno != ENOENT. From-SVN: r142192
2008-11-25re PR fortran/38248 (Ignored temporary module files manipulation errors)Jan Kratochvil1-3/+11
2008-11-25 Jan Kratochvil <jan.kratochvil@redhat.com> PR fortran/38248 * module.c (gfc_dump_module): Check rename/unlink syscalls errors. From-SVN: r142190
2008-11-19re PR fortran/38119 (character ICE in gfc_trans_create_temp_array)Paul Thomas1-2/+4
2008-11-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/38119 * module.c (load_equiv): Regression fix; check that equivalence members come from the same module only. 2008-11-19 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/module_equivalence_6.f90: New test. From-SVN: r141990
2008-10-11re PR fortran/37794 (Fortran module overloading regression)Paul Thomas1-7/+0
2008-10-11 Paul Thomas <pault@gcc.gnu.org> PR fortran/37794 * module.c (check_for_ambiguous): Remove redundant code. 2008-10-11 Paul Thomas <pault@gcc.gnu.org> PR fortran/37794 * gfortran.dg/used_types_24.f90: New test. From-SVN: r141057
2008-10-05re PR fortran/37706 (ICE with use only and equivalent)Paul Thomas1-2/+5
2008-10-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/37706 * module.c (load_equiv): Check the module before negating the unused flag. 2008-10-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/37706 * gfortran.dg/module_equivalence_4.f90: New test. From-SVN: r140879
2008-09-17re PR fortran/37274 ([Regression on 4.3?] error: type name is ambiguous.)Paul Thomas1-1/+51
2008-09-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/37274 PR fortran/36374 * module.c (check_for_ambiguous): New function to test loaded symbol for ambiguity with fixup symbol. (read_module): Call check_for_ambiguous. (write_symtree): Do not write the symtree for symbols coming from an interface body. PR fortran/36374 * resolve.c (count_specific_procs ): New function to count the number of specific procedures with the same name as the generic and emit appropriate errors for and actual argument reference. (resolve_assumed_size_actual): Add new argument no_formal_args. Correct logic around passing generic procedures as arguments. Call count_specific_procs from two locations. (resolve_function): Evaluate and pass no_formal_args. (resolve call): The same and clean up a bit by using csym more widely. PR fortran/36454 * symbol.c (gfc_add_access): Access can be updated if use associated and not private. 2008-09-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/37274 * gfortran.dg/used_types_22.f90: New test. * gfortran.dg/used_types_23.f90: New test. PR fortran/36374 * gfortran.dg/generic_17.f90: New test. * gfortran.dg/ambiguous_specific_2.f90: New test. * gfortran.dg/generic_actual_arg.f90: Add test for case that is not ambiguous. PR fortran/36454 * gfortran.dg/access_spec_3.f90: New test. From-SVN: r140434
2008-09-01re PR fortran/37193 ("USE mod, ONLY: i, i=>j" does not import "i")Daniel Kraft1-2/+7
2008-09-01 Daniel Kraft <d@domob.eu> PR fortran/37193 * module.c (read_module): Initialize use_only flag on used symbols. 2008-09-01 Daniel Kraft <d@domob.eu> PR fortran/37193 * gfortran.dg/use_rename_4.f90: New test. * gfortran.dg/use_rename_5.f90: New test. From-SVN: r139866
2008-08-31gfortran.h (enum gfc_statement): New entry `ST_GENERIC'.Daniel Kraft1-1/+43
2008-08-31 Daniel Kraft <d@domob.eu> * gfortran.h (enum gfc_statement): New entry `ST_GENERIC'. (struct gfc_tbp_generic): New type. (struct gfc_typebound_proc): Removed `target' and added union with `specific' and `generic' members; new members `overridden', `subroutine', `function' and `is_generic'. (struct gfc_expr): New members `derived' and `name' in compcall union member and changed type of `tbp' to gfc_typebound_proc. (gfc_compare_interfaces), (gfc_compare_actual_formal): Made public. * match.h (gfc_typebound_default_access): New global. (gfc_match_generic): New method. * decl.c (gfc_match_generic): New method. (match_binding_attributes): New argument `generic' and handle it. (match_procedure_in_type): Mark matched binding as non-generic. * interface.c (gfc_compare_interfaces): Made public. (gfc_compare_actual_formal): Ditto. (check_interface_1), (compare_parameter): Use new public names. (gfc_procedure_use), (gfc_search_interface): Ditto. * match.c (match_typebound_call): Set base-symbol referenced. * module.c (binding_generic): New global array. (current_f2k_derived): New global. (mio_typebound_proc): Handle IO of GENERIC bindings. (mio_f2k_derived): Record current f2k-namespace in current_f2k_derived. * parse.c (decode_statement): Handle GENERIC statement. (gfc_ascii_statement): Ditto. (typebound_default_access), (set_typebound_default_access): Removed. (gfc_typebound_default_access): New global. (parse_derived_contains): New default-access implementation and handle GENERIC statements encountered. * primary.c (gfc_match_varspec): Adapted to new gfc_typebound_proc structure and removed check for SUBROUTINE/FUNCTION from here. * resolve.c (extract_compcall_passed_object): New method. (update_compcall_arglist): Use it. (resolve_typebound_static): Adapted to new gfc_typebound_proc structure. (resolve_typebound_generic_call): New method. (resolve_typebound_call): Check target is a SUBROUTINE and handle calls to GENERIC bindings. (resolve_compcall): Ditto (check for target being FUNCTION). (check_typebound_override): Handle GENERIC bindings. (check_generic_tbp_ambiguity), (resolve_typebound_generic): New methods. (resolve_typebound_procedure): Handle GENERIC bindings and set new attributes subroutine, function and overridden in gfc_typebound_proc. (resolve_fl_derived): Ensure extended type is resolved before the extending one is. * st.c (gfc_free_statement): Fix bug with free'ing EXEC_COMPCALL's. * symbol.c (gfc_find_typebound_proc): Adapt for GENERIC changes. 2008-08-31 Daniel Kraft <d@domob.eu> * gfortran.dg/typebound_generic_1.f03: New test. * gfortran.dg/typebound_generic_2.f03: New test. * gfortran.dg/typebound_generic_3.f03: New test. From-SVN: r139822
2008-08-29gfortran.h (gfc_use_list): Add where field.Jakub Jelinek1-0/+5
* gfortran.h (gfc_use_list): Add where field. * module.c (use_locus): New static variable. (gfc_match_use): Set it. (gfc_use_module): Copy it to gfc_use_list's where field. * trans-decl.c (gfc_generate_module_vars): Call gfc_trans_use_stmts. (gfc_trans_use_stmts): Set backend locus before calling the debug hook. Allow non-VAR_DECLs to be created even for non-external module. Don't emit anything so far for renames from different modules. From-SVN: r139780
2008-08-29re PR fortran/29635 (debug info of modules)Jakub Jelinek1-14/+28
PR fortran/29635 PR fortran/23057 * debug.h (struct gcc_debug_hooks): Add NAME and CHILD arguments to imported_module_or_decl. (debug_nothing_tree_tree): Removed. (debug_nothing_tree_tree_tree_bool): New prototype. * debug.c (do_nothing_debug_hooks): Adjust. (debug_nothing_tree_tree): Removed. (debug_nothing_tree_tree_tree_bool): New function. * dwarf2out.c (is_symbol_die): Handle DW_TAG_module. (gen_variable_die): Put all common vars for the same COMMON block under one DW_TAG_common_block. (declare_in_namespace): Return new context_die, for Fortran return the module DIE instead of adding extra declarations into the namespace. (gen_type_die_with_usage): Adjust declare_in_namespace caller. (gen_namespace_die): If is_fortran (), generate DW_TAG_module instead of DW_TAG_namespace. If DECL_EXTERNAL is set, add DW_AT_declaration. (dwarf2out_global_decl): Don't skip Fortran global vars. (gen_decl_die): Likewise. Adjust declare_in_namespace callers. (dwarf2out_imported_module_or_decl): Add NAME and CHILD arguments. If NAME is non-NULL, add DW_AT_name. If CHILD is non-NULL, put DW_TAG_imported_declaration as child of previous DW_TAG_imported_module. * dbxout.c (dbx_debug_hooks, xcoff_debug_hooks): Adjust. * sdbout.c (sdb_debug_hooks): Likewise. * vmsdbgout.c (vmsdbg_debug_hooks): Likewise. * name-lookup.c (do_using_directive, cp_emit_debug_info_for_using): Adjust debug_hooks->imported_module_or_decl callers. * f95-lang.c (gfc_init_ts): New function. (LANG_HOOKS_INIT_TS): Define. * gfortran.h (gfc_use_rename): New type, moved from module.c. (gfc_get_use_rename): New macro, moved from module.c. (gfc_use_list): New type. (gfc_get_use_list): New macro. (gfc_namespace): Add use_stmts field. (gfc_free_use_stmts): New prototype. * Make-lang.in (fortran/trans-decl.o): Depend on debug.h. * module.c (gfc_use_rename, gfc_get_use_rename): Moved to gfortran.h. (gfc_use_module): Chain the USE statement info to ns->use_stmts. (gfc_free_use_stmts): New function. * symbol.c (gfc_free_namespace): Call gfc_free_use_stmts. * trans.h (struct module_htab_entry): New type. (gfc_find_module, gfc_module_add_decl): New functions. * trans.c (gfc_generate_module_code): Create NAMESPACE_DECL for the module, adjust DECL_CONTEXTs of module procedures and call gfc_module_add_decl for them. * trans-common.c (build_common_decl): Set DECL_IGNORED_P on the common variable. (create_common): Set DECL_IGNORED_P for use associated vars. * trans-decl.c: Include debug.h. (gfc_get_symbol_decl): Set DECL_IGNORED_P on use_assoc vars from modules. (build_function_decl): Allow current_function_decl's context to be a NAMESPACE_DECL. (module_htab, cur_module): New variables. (module_htab_do_hash, module_htab_eq, module_htab_decls_hash, module_htab_decls_eq, gfc_find_module, gfc_module_add_decl): New functions. (gfc_create_module_variable): Adjust DECL_CONTEXTs of module variables and types and call gfc_module_add_decl for them. (gfc_generate_module_vars): Temporarily set cur_module. (gfc_trans_use_stmts): New function. (gfc_generate_function_code): Call it. (gfc_generate_block_data): Set DECL_IGNORED_P on decl. * trans-types.c (gfc_get_derived_type): Adjust DECL_CONTEXT and TYPE_CONTEXT of module derived types. From-SVN: r139773
2008-08-28gfortran.h (enum expr_t): New value `EXPR_COMPCALL'.Daniel Kraft1-0/+88
2008-08-28 Daniel Kraft <d@domob.eu> * gfortran.h (enum expr_t): New value `EXPR_COMPCALL'. (gfc_get_typebound_proc): New macro. (struct gfc_expr): New union-member `compcall' for EXPR_COMPCALL. (enum gfc_exec_op): New value `EXEC_COMPCALL'. (gfc_find_typebound_proc): New argument. (gfc_copy_ref), (gfc_match_varspec): Made public. * decl.c (match_procedure_in_type): Use gfc_get_typebound_proc. * expr.c (free_expr0), (gfc_copy_expr): Handle EXPR_COMPCALL. (gfc_copy_ref): Made public and use new name. (simplify_const_ref): Use new name of gfc_copy_ref. (simplify_parameter_variable): Ditto. (gfc_simplify_expr): gcc_unreachable for EXPR_COMPCALL. * match.c (match_typebound_call): New method. (gfc_match_call): Allow for CALL's to typebound procedures. * module.c (binding_passing), (binding_overriding): New variables. (expr_types): Add EXPR_COMPCALL. (mio_expr): gcc_unreachable for EXPR_COMPCALL. (mio_typebound_proc), (mio_typebound_symtree): New methods. (mio_f2k_derived): Handle type-bound procedures. * primary.c (gfc_match_varspec): Made public and parse trailing references to type-bound procedures; new argument `sub_flag'. (gfc_match_rvalue): New name and argument of gfc_match_varspec. (match_variable): Ditto. * resolve.c (update_arglist_pass): New method. (update_compcall_arglist), (resolve_typebound_static): New methods. (resolve_typebound_call), (resolve_compcall): New methods. (gfc_resolve_expr): Handle EXPR_COMPCALL. (resolve_code): Handle EXEC_COMPCALL. (resolve_fl_derived): New argument to gfc_find_typebound_proc. (resolve_typebound_procedure): Ditto and removed not-implemented error. * st.c (gfc_free_statement): Handle EXEC_COMPCALL. * symbol.c (gfc_find_typebound_proc): New argument `noaccess' and implement access-checking. * trans-expr.c (gfc_apply_interface_mapping_to_expr): gcc_unreachable on EXPR_COMPCALL. * trans-intrinsic.c (gfc_conv_intrinsic_bound): Add missing break. * trans-openmp.c (gfc_trans_omp_array_reduction): Add missing intialization of ref->type. 2008-08-28 Daniel Kraft <d@domob.eu> * gfortran.dg/typebound_call_1.f03: New test. * gfortran.dg/typebound_call_2.f03: New test. * gfortran.dg/typebound_call_3.f03: New test. * gfortran.dg/typebound_call_4.f03: New test. * gfortran.dg/typebound_call_5.f03: New test. * gfortran.dg/typebound_call_6.f03: New test. * gfortran.dg/typebound_proc_1.f08: Don't expect not-implemented error. * gfortran.dg/typebound_proc_2.f90: Ditto. * gfortran.dg/typebound_proc_5.f03: Ditto. * gfortran.dg/typebound_proc_6.f03: Ditto. * gfortran.dg/typebound_proc_7.f03: Ditto. * gfortran.dg/typebound_proc_8.f03: Ditto. From-SVN: r139724
2008-08-28re PR fortran/37253 (Segmentation fault with procedure pointer)Janus Weil1-1/+13
2008-08-28 Janus Weil <janus@gcc.gnu.org> PR fortran/37253 * module.c (ab_attribute,attr_bits,mio_symbol_attribute): Take care of saving attr.procedure and attr.proc_ptr to the module file. 2008-08-28 Janus Weil <janus@gcc.gnu.org> PR fortran/37253 * gfortran.dg/proc_ptr_10.f90: New. From-SVN: r139713
2008-08-23gfortran.h (gfc_component): Add field "symbol_attribute attr"...Janus Weil1-4/+2
2008-08-23 Janus Weil <janus@gcc.gnu.org> * gfortran.h (gfc_component): Add field "symbol_attribute attr", remove fields "pointer", "allocatable", "dimension", "access". Remove functions "gfc_set_component_attr" and "gfc_get_component_attr". * interface.c (gfc_compare_derived_types): Ditto. * trans-array.c (gfc_array_allocate,structure_alloc_comps): Ditto. * trans-expr.c (gfc_conv_component_ref,gfc_trans_subcomponent_assign, gfc_conv_structure): Ditto. * symbol.c (gfc_find_component,free_components,gfc_set_component_attr, gfc_get_component_attr,verify_bind_c_derived_type, generate_isocbinding_symbol): Ditto. * decl.c (build_struct): Ditto. * dump-parse-tree.c (show_components): Ditto. * trans-stmt.c (gfc_trans_deallocate): Ditto. * expr.c (gfc_check_assign,gfc_check_pointer_assign, gfc_default_initializer): Ditto. * module.c (mio_component): Ditto. * trans-types.c (copy_dt_decls_ifequal,gfc_get_derived_type): Ditto. * resolve.c (has_default_initializer,resolve_structure_cons, gfc_iso_c_func_interface,find_array_spec,resolve_ref, resolve_deallocate_expr,resolve_allocate_expr,resolve_fl_derived, resolve_equivalence_derived): Ditto. * trans-io.c (transfer_expr): Ditto. * parse.c (parse_derived): Ditto. * dependency.c (gfc_check_dependency): Ditto. * primary.c (gfc_variable_attr): Ditto. From-SVN: r139524
2008-08-08gfortran.h (gfc_finalizer): Replaced member `procedure' by two new members ↵Daniel Kraft1-0/+75
`proc_sym' and `proc_tree' to... 2008-08-08 Daniel Kraft <d@domob.eu> * gfortran.h (gfc_finalizer): Replaced member `procedure' by two new members `proc_sym' and `proc_tree' to store the symtree after resolution. (gfc_find_sym_in_symtree): Made public. * decl.c (gfc_match_final_decl): Adapted for new member name. * interface.c (gfc_find_sym_in_symtree): Made public. (gfc_extend_expr), (gfc_extend_assign): Changed call accordingly. * module.c (mio_finalizer), (mio_f2k_derived), (mio_full_f2k_derived): New methods for module-file IO of f2k_derived. (mio_symbol): Do IO of f2k_derived namespace. * resolve.c (gfc_resolve_finalizers): Adapted for new member name and finding the symtree for the symbol here. * symbol.c (gfc_free_finalizer): Adapted for new members. 2008-08-08 Daniel Kraft <d@domob.eu> * gfortran.dg/finalize_9.f03: New test. * gfortran.dg/module_md5_1.f90: Adapted MD5-sum for changed module file format. From-SVN: r138884
2008-07-29trans-expr.c (conv_parent_component_references): New function to build ↵Paul Thomas1-1/+8
missing parent references. 2008-07-29 Paul Thomas <pault@gcc.gnu.org> fortran/ * trans-expr.c (conv_parent_component_references): New function to build missing parent references. (gfc_conv_variable): Call it * symbol.c (gfc_add_component): Check that component name in a derived type extension does not appear in parent. (gfc_find_component): For a derived type extension, check if the component appears in the parent derived type by calling self. Separate errors for private components and private types. * decl.c (match_data_constant): Add extra arg to call to gfc_match_structure_constructor. (check_extended_derived_type): New function to check that a parent derived type exists and that it is OK for exension. (gfc_get_type_attr_spec): Add extra argument 'name' and return it if extends is specified. (gfc_match_derived_decl): Match derived type extension and build a first component of the parent derived type if OK. Add the f2k namespace if not present. * gfortran.h : Add the extension attribute. * module.c : Handle attribute 'extension'. * match.h : Modify prototypes for gfc_get_type_attr_spec and gfc_match_structure_constructor. * primary.c (build_actual_constructor): New function extracted from gfc_match_structure_constructor and modified to call self iteratively to build derived type extensions, when f2k named components are used. (gfc_match_structure_constructor): Do not throw error for too many components if a parent type is being handled. Use gfc_find_component to generate errors for non-existent or private components. Iteratively call self for derived type extensions so that parent constructor is built. If extension and components left over, throw error. (gfc_match_rvalue): Add extra arg to call to gfc_match_structure_constructor. * trans-array.c (gfc_conv_resolve_dependencies): If lhs and rhs are the same symbol, aliassing does not matter. testsuite/ * gfortran.dg/extends_1.f03: New test. * gfortran.dg/extends_2.f03: New test. * gfortran.dg/extends_3.f03: New test. * gfortran.dg/extends_4.f03: New test. * gfortran.dg/extends_5.f03: New test. * gfortran.dg/extends_6.f03: New test. * gfortran.dg/private_type_6.f90: Modify error message. * gfortran.dg/structure_constructor_7.f03: Modify error message. * gfortran.dg/structure_constructor_8.f03: Modify error message. From-SVN: r138275
2008-07-21fmt_g0_3.f08: Fix typo in expected error message.Ralf Wildenhues1-4/+4
gcc/testsuite/ * gfortran.dg/fmt_g0_3.f08: Fix typo in expected error message. gcc/fortran/ * expr.c (gfc_check_pointer_assign): Fix typo in string. * io.c (check_format): Fix typo in string. Fix comment typos. * parse.c (gfc_global_used): Likewise. * resolve.c (resolve_allocate_expr): Likewise. * symbol.c (gfc_set_default_type): Likewise. * arith.c: Fix typos in comments. * array.c: Likewise. * data.c: Likewise. * decl.c: Likewise. * dependency.c: Likewise. * f95-lang.c: Likewise. * gfortran.h: Likewise. * matchexp.c: Likewise. * module.c: Likewise. * primary.c: Likewise. * scanner.c: Likewise. * trans-array.c: Likewise. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-expr.c: Likewise. * trans-intrinsic.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. * trans.h: Likewise. From-SVN: r138040
2008-07-19gfortran.h (new): Remove macro.Kaveh R. Ghazi1-17/+17
* gfortran.h (new): Remove macro. * array.c (gfc_append_constructor, match_array_list, gfc_match_array_constructor): Likewise. * bbt.c (insert, gfc_insert_bbt): Likewise. * decl.c (var_element, top_var_list, top_val_list, gfc_match_data, get_proc_name): Likewise. * expr.c (gfc_copy_actual_arglist): Likewise. * interface.c (compare_actual_formal, check_new_interface, gfc_add_interface): Likewise. * intrinsic.c gfc_convert_type_warn, gfc_convert_chartype): Likewise. * io.c (match_io_iterator, match_io_list): Likewise. * match.c (match_forall_header): Likewise. * matchexp.c (build_node): Likewise. * module.c (gfc_match_use): Likewise. * scanner.c (load_file): Likewise. * st.c (gfc_append_code): Likewise. * symbol.c (save_symbol_data, gfc_get_sym_tree, gfc_undo_symbols, gfc_commit_symbols): Likewise. * trans-common.c (build_field): Likewise. * trans-decl.c (gfc_finish_var_decl): Likewise. * trans-expr.c (gfc_free_interface_mapping, gfc_get_interface_mapping_charlen, gfc_add_interface_mapping, gfc_finish_interface_mapping, gfc_apply_interface_mapping_to_expr): Likewise. * trans.h (gfc_interface_sym_mapping): Likewise. From-SVN: r137982
2008-07-19gfortran.h (operator): Remove macro.Kaveh R. Ghazi1-26/+26
* gfortran.h (operator): Remove macro. (gfc_namespace, gfc_expr): Avoid C++ keywords. * arith.c (eval_intrinsic, eval_intrinsic_f2, eval_intrinsic_f3): Likewise. * decl.c (access_attr_decl): Likewise. * dependency.c (gfc_dep_compare_expr): Likewise. * dump-parse-tree.c (show_expr, show_uop, show_namespace): Likewise. * expr.c (gfc_copy_expr, gfc_type_convert_binary, simplify_intrinsic_op, check_intrinsic_op): Likewise. * interface.c (fold_unary, gfc_match_generic_spec, gfc_match_interface, gfc_match_end_interface, check_operator_interface, check_uop_interfaces, gfc_check_interfaces, gfc_extend_expr, gfc_extend_assign, gfc_add_interface, gfc_current_interface_head, gfc_set_current_interface_head): Likewise. * iresolve.c (gfc_resolve_dot_product, gfc_resolve_matmul): Likewise. * matchexp.c (gfc_get_parentheses, build_node): Likewise. * module.c (gfc_use_rename, gfc_match_use, find_use_name_n, number_use_names, mio_expr, load_operator_interfaces, read_module, write_operator, write_module): Likewise. * openmp.c (resolve_omp_atomic): Likewise. * resolve.c (resolve_operator, gfc_resolve_character_operator, gfc_resolve_uops): Likewise. * symbol.c (free_uop_tree, gfc_free_namespace): Likewise. * trans-expr.c (gfc_conv_expr_op): Likewise. * trans-openmp.c (gfc_trans_omp_atomic): Likewise. From-SVN: r137981
2008-07-19gfortran.h (protected): Remove macro.Kaveh R. Ghazi1-2/+2
* gfortran.h (protected): Remove macro. * dump-parse-tree.c (show_attr): Avoid C++ keywords. * expr.c (gfc_check_pointer_assign): Likewise. * interface.c (compare_parameter_protected): Likewise. * intrinsic.c (enum class, add_sym, add_sym_0, add_sym_1, add_sym_1s, add_sym_1m, add_sym_2, add_sym_2s, add_sym_3, add_sym_3ml, add_sym_3red, add_sym_3s, add_sym_4, add_sym_4s, add_sym_5s): Likewise. * match.c (gfc_match_assignment, gfc_match_pointer_assignment): Likewise. * module.c (mio_symbol_attribute): Likewise. * primary.c (match_variable): Likewise. * resolve.c (resolve_equivalence): Likewise. * symbol.c (check_conflict, gfc_add_protected, gfc_copy_attr): Likewise. * trans-types.c (gfc_get_array_type_bounds): Likewise. From-SVN: r137980
2008-06-20arith.c (hollerith2representation): Fix for -Wc++-compat.Kaveh R. Ghazi1-13/+13
* arith.c (hollerith2representation): Fix for -Wc++-compat. * array.c (gfc_get_constructor): Likewise. * decl.c (gfc_get_data_variable, gfc_get_data_value, gfc_get_data, create_enum_history, gfc_match_final_decl): Likewise. * error.c (error_char): Likewise. * expr.c (gfc_get_expr, gfc_copy_expr): Likewise. * gfortran.h (gfc_get_charlen, gfc_get_array_spec, gfc_get_component, gfc_get_formal_arglist, gfc_get_actual_arglist, gfc_get_namelist, gfc_get_omp_clauses, gfc_get_interface, gfc_get_common_head, gfc_get_dt_list, gfc_get_array_ref, gfc_get_ref, gfc_get_equiv, gfc_get_case, gfc_get_iterator, gfc_get_alloc, gfc_get_wide_string): Likewise. * interface.c (count_types_test): Likewise. * intrinsic.c (add_char_conversions, gfc_intrinsic_init_1): Likewise. * io.c (gfc_match_open, gfc_match_close, match_filepos, match_io, gfc_match_inquire, gfc_match_wait): Likewise. * match.c (gfc_match, match_forall_iterator): Likewise. * module.c (gfc_get_pointer_info, gfc_get_use_rename, add_fixup, add_true_name, parse_string, write_atom, quote_string, mio_symtree_ref, mio_gmp_real, write_common_0): Likewise. * options.c (gfc_post_options): Likewise. * primary.c (match_integer_constant, match_hollerith_constant, match_boz_constant, match_real_constant, gfc_get_structure_ctor_component, gfc_match_structure_constructor): Likewise. * scanner.c (gfc_widechar_to_char, add_path_to_list, add_file_change, load_line, get_file, preprocessor_line, load_file, unescape_filename, gfc_read_orig_filename): Likewise. * simplify.c (gfc_simplify_ibits, gfc_simplify_ishft, gfc_simplify_ishftc): Likewise. * symbol.c (gfc_get_st_label, gfc_get_namespace, gfc_new_symtree, gfc_get_uop, gfc_new_symbol, save_symbol_data, gfc_get_gsymbol): Likewise. * target-memory.c (gfc_target_interpret_expr): Likewise. * trans-const.c (gfc_build_wide_string_const): Likewise. * trans-expr.c (gfc_add_interface_mapping): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_conversion, gfc_conv_intrinsic_int, gfc_conv_intrinsic_lib_function, gfc_conv_intrinsic_cmplx, gfc_conv_intrinsic_ctime, gfc_conv_intrinsic_fdate, gfc_conv_intrinsic_ttynam, gfc_conv_intrinsic_minmax, gfc_conv_intrinsic_minmax_char, gfc_conv_intrinsic_ishftc, gfc_conv_intrinsic_index_scan_verify, gfc_conv_intrinsic_merge, gfc_conv_intrinsic_trim): Likewise. * trans.c (gfc_get_backend_locus): Likewise. * trans.h (gfc_get_ss): Likewise. From-SVN: r136982
2008-05-15Add new parameter to NAMED_INTCST and new field standard to struct intmod_sym.Sa Liu1-3/+4
From-SVN: r135340
2008-05-10re PR fortran/36197 ([4.4 Regressio]: gfortran.dg/initialization_12.f90)Francois-Xavier Coudert1-1/+1
PR fortran/36197 * module.c (quote_string): Fix sprintf format. From-SVN: r135154
2008-05-09re PR fortran/36162 (Non-ASCII character in module string gives ICE)Francois-Xavier Coudert1-9/+132
PR fortran/36162 * module.c (quote_string, unquote_string, mio_allocated_wide_string): New functions. (mio_expr): Call mio_allocated_wide_string where needed. * gfortran.dg/module_widestring_1.f90: New test. From-SVN: r135109
2008-05-06arith.c: (gfc_arith_concat...Francois-Xavier Coudert1-4/+9
* arith.c: (gfc_arith_concat, gfc_compare_string, gfc_compare_with_Cstring, hollerith2representation, gfc_hollerith2int, gfc_hollerith2real, gfc_hollerith2complex, gfc_hollerith2character, gfc_hollerith2logical): Use wide characters for character constants. * data.c (create_character_intializer): Likewise. * decl.c (gfc_set_constant_character_len): Likewise. * dump-parse-tree.c (show_char_const): Correctly dump wide character strings. error.c (print_wide_char): Rename into gfc_print_wide_char. (show_locus): Adapt to new prototype of gfc_print_wide_char. expr.c (free_expr0): Representation is now disjunct from character string value, so we always free it. (gfc_copy_expr, find_substring_ref, gfc_simplify_expr): Adapt to wide character strings. * gfortran.h (gfc_expr): Make value.character.string a wide string. (gfc_wide_toupper, gfc_wide_strncasecmp, gfc_wide_memset, gfc_widechar_to_char, gfc_char_to_widechar): New prototypes. (gfc_get_wide_string): New macro. (gfc_print_wide_char): New prototype. * io.c (format_string): Make a wide string. (next_char, gfc_match_format, compare_to_allowed_values, gfc_match_open): Deal with wide strings. * module.c (mio_expr): Convert between wide strings and ASCII ones. * primary.c (match_hollerith_constant, match_charkind_name): Handle wide strings. * resolve.c (build_default_init_expr): Likewise. * scanner.c (gfc_wide_toupper, gfc_wide_memset, gfc_char_to_widechar): New functions. (wide_strchr, gfc_widechar_to_char, gfc_wide_strncasecmp): Changes in prototypes. (gfc_define_undef_line, load_line, preprocessor_line, include_line, load_file, gfc_read_orig_filename): Handle wide strings. * simplify.c (gfc_simplify_achar, gfc_simplify_adjustl, gfc_simplify_adjustr, gfc_simplify_char, gfc_simplify_iachar, gfc_simplify_ichar, simplify_min_max, gfc_simplify_new_line, gfc_simplify_repeat): Handle wide strings. (wide_strspn, wide_strcspn): New helper functions. (gfc_simplify_scan, gfc_simplify_trim, gfc_simplify_verify): Handle wide strings. * symbol.c (generate_isocbinding_symbol): Likewise. * target-memory.c (size_character, gfc_target_expr_size, encode_character, gfc_target_encode_expr, gfc_interpret_character, gfc_target_interpret_expr): Handle wide strings. * trans-const.c (gfc_conv_string_init): Lower wide strings to narrow ones. (gfc_conv_constant_to_tree): Likewise. * trans-expr.c (gfc_conv_substring_expr): Handle wide strings. * trans-io.c (gfc_new_nml_name_expr): Likewise. * trans-stmt.c (gfc_trans_label_assign): Likewise. From-SVN: r135006
2008-04-30re PR fortran/35997 (Used function interface bug)Paul Thomas1-4/+11
2008-04-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/35997 * module.c (find_symbol): Do not return a result for a symbol that has been renamed in another module. 2008-04-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/35997 * gfortran.dg/use_rename_3.f90 From-SVN: r134836
2008-03-09re PR fortran/35474 (Reading module file with COMMON and EQUIVALENCE)Paul Thomas1-0/+6
2008-03-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/35474 * module.c (mio_symtree_ref): After providing a symbol for a missing equivalence member, resolve and NULL the fixups. 2008-03-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/35474 * gfortran.dg/module_commons_2.f90 : New test. From-SVN: r133063
2008-02-24arith.c: Update copyright years.Tobias Schlüter1-1/+1
* arith.c: Update copyright years. * arith.h: Likewise. * array.c: Likewise. * bbt.c: Likewise. * check.c: Likewise. * data.c: Likewise. * data.h: Likewise. * decl.c: Likewise. * dependency.c: Likewise. * dependency.h: Likewise. * dump-parse-tree.c: Likewise. * error.c: Likewise. * expr.c: Likewise. * gfc-internals.texi: Likewise. * gfortran.h: Likewise. * gfortran.texi: Likewise. * gfortranspec.c: Likewise. * interface.c: Likewise. * intrinsic.c: Likewise. * intrinsic.h: Likewise. * intrinsic.texi: Likewise. * invoke.texi: Likewise. * io.c: Likewise. * iresolve.c: Likewise. * iso-c-binding.def: Likewise. * iso-fortran-env.def: Likewise. * lang-specs.h: Likewise. * lang.opt: Likewise. * libgfortran.h: Likewise. * match.c: Likewise. * match.h: Likewise. * matchexp.c: Likewise. * misc.c: Likewise. * module.c: Likewise. * openmp.c: Likewise. * options.c: Likewise. * parse.c: Likewise. * parse.h: Likewise. * primary.c: Likewise. * resolve.c: Likewise. * scanner.c: Likewise. * simplify.c: Likewise. * st.c: Likewise. * symbol.c: Likewise. * target-memory.c: Likewise. * target-memory.h: Likewise. * trans-array.h: Likewise. * trans-const.h: Likewise. * trans-stmt.h: Likewise. * trans-types.c: Likewise. * trans-types.h: Likewise. * types.def: Likewise. From-SVN: r132600
2008-01-30re PR fortran/34975 (Bogus error with USEing modules)Paul Thomas1-9/+15
2008-01-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/34975 * symbol.c (gfc_delete_symtree, gfc_undo_symbols): Rename delete_symtree to gfc_delete_symtree. * gfortran.h : Add prototype for gfc_delete_symtree. * module.c (load_generic_interfaces): Transfer symbol to a unique symtree and delete old symtree, instead of renaming. (read_module): The rsym and the found symbol are the same, so the found symtree can be deleted. PR fortran/34429 * decl.c (match_char_spec): Remove the constraint on deferred matching of functions and free the length expression. delete_symtree to gfc_delete_symtree. (gfc_match_type_spec): Whitespace. (gfc_match_function_decl): Defer characteristic association for all types except BT_UNKNOWN. * parse.c (decode_specification_statement): Only derived type function matching is delayed to the end of specification. 2008-01-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/34975 * gfortran.dg/use_only_3.f90: New test. * gfortran.dg/use_only_3.inc: Modules for new test. PR fortran/34429 * gfortran.dg/function_charlen_2.f90: New test. From-SVN: r131956
2008-01-22re PR fortran/34896 (libgomp.fortran/reduction5.f90)Paul Thomas1-0/+3
2008-01-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/34896 * module.c (read_module): Set use_rename attribute. 2008-01-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/34896 * gfortran.dg/use_rename_2.f90: New test. From-SVN: r131712
2008-01-20re PR fortran/34861 (ICE in function with entry (and result?))Paul Thomas1-1/+1
2008-01-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/34861 * resolve.c (resolve_entries): Do not do an array bounds check if the result symbols are the same. PR fortran/34854 * module.c (read_module) : Hide the symtree of the previous version of the symbol if this symbol is renamed. 2008-01-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/34784 * gfortran.dg/mapping_2.f90: Correct ubound expression for h4. PR fortran/34861 * gfortran.dg/entry_array_specs_3.f90: New test. PR fortran/34854 * gfortran.dg/use_rename_1.f90: New test. From-SVN: r131679
2008-01-07re PR fortran/34672 (.mod file misses renamed, USEd symbol)Paul Thomas1-20/+15
2008-01-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/34672 * module.c (write_generic): Rewrite completely. (write_module): Change call to write_generic. 2008-01-07 Paul Thomas <pault@gcc.gnu.org> PR fortran/34672 * gfortran.dg/use_only_2.f90: New test. From-SVN: r131377
2008-01-06re PR fortran/34545 (ICE when compiling Fortran 95 code)Paul Thomas1-0/+6
2008-01-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/34545 * module.c (load_needed): If the namespace has no proc_name give it the module symbol. 2008-01-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/34545 * gfortran.dg/use_12.f90: New test. From-SVN: r131364
2007-12-21re PR fortran/34438 (gfortran not compliant w.r.t default initialization of ↵Paul Thomas1-0/+1
derived type component and implicit SAVE attribute) 2007-12-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/34438 * trans-decl.c (gfc_finish_var_decl): Do not mark derived types with default initializers as TREE_STATIC unless they are in the main program scope. (gfc_get_symbol_decl): Pass derived types with a default initializer to gfc_defer_symbol_init. (init_default_dt): Apply default initializer to a derived type. (init_intent_out_dt): Call init_default_dt. (gfc_trans_deferred_vars): Ditto. * module.c (read_module): Check sym->module is there before using it in a string comparison. 2007-12-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/34438 * gfortran.dg/default_initialization_3.f90: New test. From-SVN: r131124
2007-12-14re PR fortran/34324 (Module files on CRLF systems)Daniel Franke1-1/+1
2007-12-14 Daniel Franke <franke.daniel@gmail.com> PR fortran/34324 * module.c (parse_atom): Fixed parsing of modules files whose lines are terminated by CRLF. From-SVN: r130928
2007-12-06re PR target/34435 (SSE2 intrinsics - emmintrin with optimisations off and ↵Paul Thomas1-1/+2
type conversion error) 2007-12-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/34435 * module.c (find_symbol): Do not return symtrees with unique names, which shows that they are private. 2007-12-06 Paul Thomas <pault@gcc.gnu.org> PR fortran/34435 * gfortran.dg/used_types_19.f90: New test. From-SVN: r130642
2007-12-04re PR fortran/34318 (Modules: Infinity/NaN parameters read as 0.0)Tobias Burnus1-0/+8
2007-12-04 Tobias Burnus <burnus@net-b.de> PR fortran/34318 * module.c (mio_gmp_real): Properly write NaN and Infinity. 2007-12-04 Tobias Burnus <burnus@net-b.de> PR fortran/34318 * gfortran.dg/module_nan.f90: New. From-SVN: r130600
2007-11-27re PR fortran/33541 (gfortran wrongly imports renamed-use-associated symbol ↵Paul Thomas1-6/+16
unrenamed) 2007-11-27 Paul Thomas <pault@gcc.gnu.org> PR fortran/33541 *interface.c (compare_actual_formal): Exclude assumed size arrays from the possibility of scalar to array mapping. * decl.c (get_proc_name): Fix whitespace problem. PR fortran/34231 * gfortran.h : Add 'use_rename' bit to symbol_attribute. * module.c : Add 'renamed' field to pointer_info.u.rsym. (load_generic_interfaces): Add 'renamed' that is set after the number_use_names is called. This is used to set the attribute use_rename, which, in its turn identifies those symbols that have not been renamed. (load_needed): If pointer_info.u.rsym->renamed is set, then set the use_rename attribute of the symbol. (read_module): Correct an erroneous use of use_flag. Use the renamed flag and the use_rename attribute to determine which symbols are not renamed. 2007-11-27 Paul Thomas <pault@gcc.gnu.org> PR fortran/33541 * gfortran.dg/use_11.f90: New test. PR fortran/34231 * gfortran.dg/generic_15.f90: New test. From-SVN: r130471
2007-11-24re PR fortran/33541 (gfortran wrongly imports renamed-use-associated symbol ↵Paul Thomas1-40/+128
unrenamed) 2007-11-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/33541 * module.c (find_symtree_for_symbol): Move to new location. (find_symbol): New function. (load_generic_interfaces): Rework completely so that symtrees have the local name and symbols have the use name. Renamed generic interfaces exclude the use of the interface without an ONLY clause (11.3.2). (read_module): Implement 11.3.2 in the same way as for generic interfaces. 2007-11-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/33541 * gfortran.dg/nested_modules_1.f90: Change the reference to FOO, forbidden by the standard, to a reference to W. * gfortran.dg/use_only_1.f90: New test. From-SVN: r130395
2007-11-24re PR fortran/34187 (BIND(C): Public generic with private bind(c) specific ↵Tobias Burnus1-0/+1
does not use bind(C) name) 2007-11-23 Tobias Burnus <burnus@net-b.de> PR fortran/34187 * module.c (load_needed): Ensure binding_label is not lost. * decl.c (set_binding_label,gfc_match_bind_c): Replace strncpy by strcpy. 2007-11-23 Tobias Burnus <burnus@net-b.de> PR fortran/34187 * gfortran.dg/bind_c_usage_15.f90: New. From-SVN: r130386
2007-11-17re PR fortran/30285 (gfortran excessive memory usage with COMMON blocks in ↵Francois-Xavier Coudert1-24/+92
modules) PR fortran/30285 * module.c (struct written_common, written_commons): New structure. (compare_written_commons, free_written_common, write_common_0): New functions. (write_common): Call recursive function write_common_0. From-SVN: r130257
2007-10-31[multiple changes]Tobias Burnus1-6/+6
2007-10-31 Tobias Burnus <burnus@net-b.de> PR fortran/33941 * modules.c (intrinsics): Use only alphabetic names for intrinsic operators. 2007-10-31 Dominique d'Humieres <dominiq@lps.ens.fr> Tobias Burnus <burnus@net-b.de> PR fortran/33941 * gfortran.dg/module_read_1.f90: New. From-SVN: r129801
2007-10-28re PR fortran/32147 (Module file change due to order of writting out changes)Tobias Schlüter1-23/+29
fortran/ PR fortran/32147 * module.c (write_symbol): Fix whitespace. (write_symbol0): Walk symtree from left-to-right instead breadth-first. (write_symbol1): Similarly change walk of pointer info tree. (write_module): Insert linebreak. * symbol.c (gfc_traverse_symtree): Change to left-to-right order. (traverse_ns): Likewise. testsuite/ PR fortran/32147 * gfortran.dg/module_md5_1.f90: Update hash-value. From-SVN: r129701
2007-09-28module.c (mio_expr): Avoid -Wcast-qual warning.Kaveh R. Ghazi1-2/+2
* module.c (mio_expr): Avoid -Wcast-qual warning. From-SVN: r128854
2007-09-20re PR fortran/33221 (Cannot declare variables of TYPE without components)Francois-Xavier Coudert1-1/+7
PR fortran/33221 * gfortran.h (symbol_attribute): Add zero_comp field. * symbol.c (gfc_use_derived): Handle case of emtpy derived types. * decl.c (gfc_match_data_decl): Likewise. (gfc_match_derived_decl): Likewise. * module.c (ab_attribute, attr_bits): Add AB_ZERO_COMP member. (mio_symbol_attribute): Write and read AB_ZERO_COMP. * resolve.c (resolve_symbol): Handle case of emtpy derived types. * parse.c (parse_derived): Likewise. * gfortran.dg/used_types_18.f90: Declare variable of empty derived type. From-SVN: r128633
2007-08-26re PR fortran/31298 ([F03] use mod, operator(+) => operator(.userOp.) not ↵Tobias Burnus1-13/+37
supported) 2007-08-26 Tobias Burnus <burnus@net-b.de> PR fortran/31298 * module.c (mio_symbol_ref,mio_interface_rest): Return pointer_info. (load_operator_interfaces): Support multible loading of an operator. 2007-08-26 Tobias Burnus <burnus@net-b.de> PR fortran/31298 * gfortran.dg/use_10.f90: New. From-SVN: r127812
2007-08-19[multiple changes]Tobias Burnus1-1/+3
2007-08-18 Tobias Burnus <burnus@net-b.de> * gfortran.h (gfc_is_intrinsic_typename): Add declaration. * symbol.c (gfc_is_intrinsic_typename): New function. * parse.c (decode_statement): Check for space in ABSTRACT INTERFACE. (parse_interface): Use gfc_is_intrinsic_typename. * decl.c (gfc_match_derived_decl): Ditto. * module.c (gfc_match_use): Use gcc_unreachable() for INTERFACE_ABSTRACT in switch(). 2007-08-19 Tobias Burnus <burnus@net-b.de> * gfortran.dg/interface_abstract_2.f90: New. * gfortran.dg/interface_abstract_1.f90: Fix typo. From-SVN: r127626
2007-08-18[multiple changes]Tobias Burnus1-1/+8
2007-08-18 Paul Thomas <pault@gcc.gnu.org> Janus Weil <jaydub66@gmail.com> * interface.c (gfc_match_interface,gfc_match_abstract_interface, gfc_match_end_interface,gfc_add_interface): Add abstract interface. * dump-parse-tree.c (gfc_show_attr): Ditto. * gfortran.h (interface_type,symbol_attribute): Ditto. * module.c (gfc_match_use,ab_attribute,attr_bits, mio_symbol_attribute): Ditto. * resolve.c (resolve_function): Ditto. * match.h: Ditto. * parse.c (decode_statement): Ditto. (parse_interface): Ditto, check for C1203 (name of abstract interface cannot be the same as an intrinsic type). * decl.c (gfc_match_bind_c): Check for NAME= with abstract interfaces. (access_attr_decl): Handle Abstract interfaces. 2007-08-17 Tobias Burnus <burnus@net-b.de> * gfortran.dg/interface_abstract_1.f90: New. From-SVN: r127612
2007-08-16re PR fortran/33072 ("use mod, only: operator(.sub.)" matches any procedure ↵Tobias Burnus1-16/+23
"sub") 2007-08-16 Tobias Burnus <burnus@net-b.de> PR fortran/33072 * module.c (gfc_match_use): Mark user operators as such. (find_use_name_n): Distinguish between operators and other symbols. (find_use_name,number_use_names,mio_namelist, load_operator_interfaces,load_generic_interfaces,read_module, write_generic): Update find_use_name_n calls. 2007-08-16 Tobias Burnus <burnus@net-b.de> PR fortran/33072 * gfortran.dg/use_9.f90: New. From-SVN: r127564
2007-08-12re PR fortran/31629 (option to make module entities PRIVATE by default)Francois-Xavier Coudert1-1/+4
PR fortran/31629 * lang.opt (-fmodule-private): New option. * gfortran.h (gfc_option_t): Add flag_module_private member. * invoke.texi (-fmodule-private): Document the new option. * module.c (gfc_check_access): Allow the -fmodule-private option to modify the default behaviour. * options.c (gfc_init_options): Initialize flag_module_private. (gfc_handle_option): Handle -fmodule-private. * gfortran.dg/module_private_1.f90: New test. From-SVN: r127381
2007-08-04re PR fortran/31214 (User-defined operator using entry leads to ICE)Paul Thomas1-17/+3
2007-08-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/31214 * symbol.c (get_unique_symtree): Moved from module.c. * module.c (get_unique_symtree): Moved to symbol.c. * decl.c (get_proc_name): Transfer the typespec from the local symbol to the module symbol, in the case that an entry is also a module procedure. Ensure the local symbol is cleaned up by pointing to it with a unique symtree. * dump_parse_tree (gfc_show_code_node): Add EXEC_ASSIGN_CALL. 2007-08-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/31214 * gfortran.dg/entry_13.f90: New test. * gfortran.dg/entry_12.f90: Clean up .mod file. From-SVN: r127213