aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/symbol.c
AgeCommit message (Collapse)AuthorFilesLines
2011-05-29re PR fortran/47601 ([OOP] Internal Error: mio_component_ref(): Component ↵Janus Weil1-1/+1
not found) 2011-05-29 Janus Weil <janus@gcc.gnu.org> PR fortran/47601 * module.c (mio_component_ref): Handle components of extended types. * symbol.c (gfc_find_component): Return is sym is NULL. 2011-05-29 Janus Weil <janus@gcc.gnu.org> PR fortran/47601 * gfortran.dg/extends_13.f03: New. From-SVN: r174416
2011-04-18convert each use of gfc_free (p) to free (p)Jim Meyering1-21/+21
Do that by running this command: perl -pi -e 's/\bgfc_free ?\(/free (/' \ $(git grep -El '\bgfc_free ?\(') which also corrects the few uses that lacked a space between the function name and the open parenthesis. Manually undo the change to the function definition itself and its prototype. They'll be removed next. * array.c (gfc_free_array_spec, gfc_set_array_spec): s/gfc_free/free/ * constructor.c (node_free): Likewise. * cpp.c (dump_queued_macros): Likewise. * data.c (gfc_assign_data_value): Likewise. * decl.c (free_variable, free_value, gfc_free_data): Likewise. (gfc_free_data_all, match_old_style_init): Likewise. (gfc_set_constant_character_len, gfc_free_enum_history, NUM_DECL): Likewise. (gfc_match_modproc): Likewise. * dependency.c (check_section_vs_section): Likewise. * error.c (gfc_pop_error, gfc_free_error): Likewise. * expr.c (free_expr0, gfc_free_expr, gfc_free_actual_arglist): Likewise. (gfc_free_ref_list, gfc_replace_expr, gfc_copy_ref): Likewise. (find_substring_ref, gfc_simplify_expr, gfc_check_assign_symbol): Likewise. * frontend-passes.c (gfc_run_passes, cfe_expr_0): Likewise. (strip_function_call, optimize_comparison): Likewise. * interface.c (gfc_free_interface, arginfo, check_interface0): Likewise. (CHECK_OS_COMPARISON, gfc_extend_assign, gfc_free_formal_arglist): Likewise. * intrinsic.c (gfc_intrinsic_done_1, gfc_convert_type_warn): Likewise. (gfc_convert_chartype): Likewise. * io.c (gfc_free_open, compare_to_allowed_values, gfc_free_close): Likewise. (gfc_free_filepos, gfc_free_dt, gfc_free_inquire): Likewise. * match.c (gfc_free_iterator, gfc_match_associate): Likewise. (gfc_free_alloc_list, gfc_free_namelist, gfc_free_equiv_until): Likewise. (free_case, gfc_free_forall_iterator): Likewise. * misc.c: Likewise. * module.c (free_pi_tree, resolve_fixups, free_rename): Likewise. (free_true_name, peek_atom, mio_allocated_wide_string): Likewise. (mio_pool_string, mio_internal_string, mio_gmp_integer): Likewise. (mio_gmp_real, mio_expr, mio_typebound_proc): Likewise. (mio_full_typebound_tree, skip_list, load_equiv): Likewise. (free_written_common, gfc_use_module, gfc_free_use_stmts): Likewise. * openmp.c (gfc_free_omp_clauses): Likewise. * options.c (gfc_post_options): Likewise. * parse.c (select_type_pop, parse_omp_structured_block): Likewise. * primary.c (gfc_free_structure_ctor_component): Likewise. * resolve.c (resolve_structure_cons, check_host_association): Likewise. (gfc_resolve_forall, resolve_equivalence): Likewise. * scanner.c (gfc_scanner_done_1, gfc_release_include_path): Likewise. (gfc_define_undef_line, preprocessor_line, include_line): Likewise. (load_file, gfc_read_orig_filename): Likewise. * simplify.c (simplify_transformation_to_array): Likewise. (gfc_simplify_ibits, simplify_shift, gfc_simplify_ishftc, STRING): Likewise. (gfc_simplify_compiler_options): Likewise. * st.c (gfc_free_statement, gfc_free_statements): Likewise. (gfc_free_association_list): Likewise. * symbol.c (free_components, gfc_free_st_label, free_st_labels): Likewise. (gfc_delete_symtree, gfc_free_symbol, gfc_undo_symbols): Likewise. (free_old_symbol, gfc_commit_symbols, free_tb_tree): Likewise. (free_common_tree, free_uop_tree, free_sym_tree): Likewise. (gfc_free_dt_list, gfc_free_equiv_infos, gfc_free_equiv_lists): Likewise. (gfc_free_finalizer, gfc_free_charlen, free_entry_list): Likewise. (gfc_free_namespace): Likewise. * trans-array.c (gfc_free_ss, gfc_trans_array_bound_check): Likewise. (gfc_conv_array_ref, gfc_conv_ss_startstride): Likewise. (gfc_trans_dummy_array_bias, gfc_conv_array_parameter): Likewise. * trans-common.c (get_init_field, create_common): Likewise. * trans-const.c (gfc_build_wide_string_const): Likewise. (gfc_conv_string_init): Likewise. * trans-decl.c (gfc_generate_function_code): Likewise. * trans-expr.c (gfc_conv_substring, gfc_free_interface_mapping): Likewise. (SCALAR_POINTER, gfc_conv_statement_function): Likewise. (gfc_trans_subarray_assign): Likewise. * trans-intrinsic.c (conv_generic_with_optional_char_arg): Likewise. * trans-io.c (gfc_trans_io_runtime_check, set_string): Likewise. (transfer_namelist_element, transfer_array_component): Likewise. * trans-openmp.c (gfc_trans_omp_array_reduction): Likewise. * trans-stmt.c (cleanup_forall_symtrees, gfc_trans_forall_1): Likewise. * trans.c (trans_runtime_error_vararg, gfc_restore_backend_locus): Likewise. From-SVN: r172666
2011-01-26re PR fortran/47339 (Fortran 2003/2008: Valid NAMELIST rejected; Fortran 95: ↵Tobias Burnus1-3/+8
Invalid namelist objects accepted) 2011-01-26 Tobias Burnus <burnus@net-b.de> PR fortran/47339 PR fortran/43062 * match.c (gfc_match_namelist): Allow assumed-length characters. * resolve.c (resolve_fl_namelist): Adapt and add error messages. * symbol.c (check_conflict): Allow allocatables in NML for * F2003. * trans-io.c (nml_get_addr_expr,transfer_namelist_element): Changes due to that change. 2011-01-26 Tobias Burnus <burnus@net-b.de> PR fortran/47339 PR fortran/43062 * fortran.dg/namelist_69.f90: New test. * fortran.dg/namelist_70.f90: New test. * fortran.dg/namelist_assumed_char.f90: Modify dg-error, augment * test. * fortran.dg/namelist_3.f90: Adapt test. * fortran.dg/namelist_34.f90: Ditto. * fortran.dg/namelist_35.f90: Ditto. * fortran.dg/namelist_5.f90: Ditto. * fortran.dg/namelist_63.f90: Ditto. * gfortran.dg/alloc_comp_constraint_1.f90: Ditto. From-SVN: r169282
2011-01-08re PR fortran/46896 (Wrong code with transpose(a) passed to subroutine)Paul Thomas1-1/+4
2011-01-08 Paul Thomas <pault@gcc.gnu.org> PR fortran/46896 * trans-expr.c (gfc_conv_procedure_call): With a non-copying procedure argument (eg TRANSPOSE) use a temporary if there is any chance of aliasing due to host or use association. (arrayfunc_assign_needs_temporary): Correct logic for function results and do not use a temporary for implicitly PURE variables. Use a temporary for Cray pointees. * symbol.c (gfc_add_save): Explicit SAVE not compatible with implicit pureness of containing procedure. * decl.c (match_old_style_init, gfc_match_data): Where decl would fail in PURE procedure, set implicit_pure to zero. * gfortran.h : Add implicit_pure to structure symbol_attr and add prototype for function gfc_implicit_pure. * expr.c (gfc_check_pointer_assign, gfc_check_vardef_context): Where decl would fail in PURE procedure, reset implicit_pure. * io.c (match_vtag, gfc_match_open, gfc_match_close, gfc_match_print, gfc_match_inquire, gfc_match_wait): The same. * match.c (gfc_match_critical, gfc_match_stopcode, sync_statement, gfc_match_allocate, gfc_match_deallocate): The same. * parse.c (decode_omp_directive): The same. (parse_contained): If not PURE, set implicit pure attribute. * resolve.c (resolve_formal_arglist, resolve_structure_cons, resolve_function, resolve_ordinary_assign) : The same. (gfc_implicit_pure): New function. * module.c (mio_symbol_attribute): Introduce AB_IMPLICIT_PURE to ab_attribute enum and use it in this function. 2011-01-08 Paul Thomas <pault@gcc.gnu.org> PR fortran/46896 * gfortran.dg/transpose_optimization_2.f90 : New test. From-SVN: r168600
2011-01-08re PR fortran/45777 (Alias analysis broken for arrays where LHS or RHS is a ↵Thomas Koenig1-35/+0
component ref) 2011-01-08 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/45777 * symbol.c (gfc_symbols_could_alias): Strip gfc_ prefix, make static and move in front of its only caller, to ... * trans-array.c (symbols_could_alias): ... here. Pass information about pointer and target status as arguments. Allocatable arrays don't alias anything unless they have the POINTER attribute. (gfc_could_be_alias): Keep track of pointer and target status when following references. Also check if typespecs of components match those of other components or symbols. 2011-01-08 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/45777 * gfortran.dg/dependency_39.f90: New test. From-SVN: r168596
2011-01-07re PR fortran/47189 ([OOP] calling STORAGE_SIZE on a NULL-initialized class ↵Janus Weil1-29/+0
pointer) 2011-01-07 Janus Weil <janus@gcc.gnu.org> PR fortran/47189 PR fortran/47194 * gfortran.h (gfc_lval_expr_from_sym): Moved prototype. * class.c (gfc_class_null_initializer): Initialize _vptr to declared type. * expr.c (gfc_lval_expr_from_sym): Moved here from symbol.c. * resolve.c (resolve_deallocate_expr): _data component will be added at translation stage. * symbol.c (gfc_lval_expr_from_sym): Moved to expr.c. * trans-stmt.c (gfc_trans_deallocate): Reset _vptr to declared type. 2011-01-07 Janus Weil <janus@gcc.gnu.org> PR fortran/47189 PR fortran/47194 * gfortran.dg/storage_size_3.f08: Extended. From-SVN: r168565
2010-12-13re PR fortran/46884 (Use of charlen after free)Jakub Jelinek1-4/+14
PR fortran/46884 * symbol.c (gfc_new_charlen): If old_cl is non-NULL, put it at the ns->old_cl_list spot in the chain rather than at ns->cl_list. * gfortran.dg/pr46884.f: New test. From-SVN: r167742
2010-11-11symbol.c (verify_bind_c_derived_type): Accept BIND(C) on an empty derived type.Steven G. Kargl1-4/+15
2010-11-10 Steven G. Kargl <kargl@gcc.gnu.org> * symbol.c (verify_bind_c_derived_type): Accept BIND(C) on an empty derived type. 2010-11-10 Steven G. Kargl <kargl@gcc.gnu.org> * gfortran.dg/empty_derived_type.f90: New test. From-SVN: r166633
2010-10-06symbol.c (gfc_copy_formal_args_ppc): Free previous formal arg list before ↵Mikael Morin1-0/+1
overwriting it. 2010-10-06 Mikael Morin <mikael@gcc.gnu.org> * symbol.c (gfc_copy_formal_args_ppc): Free previous formal arg list before overwriting it. From-SVN: r165040
2010-10-06array.c (gfc_match_array_spec): Don't re-initialize cleared struct.Mikael Morin1-8/+1
2010-10-06 Mikael Morin <mikael@gcc.gnu.org> * array.c (gfc_match_array_spec): Don't re-initialize cleared struct. * symbol.c (gen_shape_param): Ditto. From-SVN: r165039
2010-10-06symbol.c (free_entry_list): New function.Mikael Morin1-0/+17
2010-10-06 Mikael Morin <mikael@gcc.gnu.org> * symbol.c (free_entry_list): New function. (gfc_free_namespace): Free list of entries. From-SVN: r165038
2010-10-06symbol.c (free_components): Free list of formal args and formal namespace.Mikael Morin1-0/+3
2010-10-06 Mikael Morin <mikael@gcc.gnu.org> * symbol.c (free_components): Free list of formal args and formal namespace. From-SVN: r165037
2010-09-27re PR fortran/40569 (F2008: Support COMPILER_OPTIONS() / COMPILER_VERSION())Tobias Burnus1-0/+7
2010-09-27 Tobias Burnus <burnus@net-b.de> PR fortran/40569 PR fortran/40568 * intrinsic.h (gfc_simplify_compiler_options, gfc_simplify_compiler_version): New prototypes. * intrinsic.c (gfc_intrinsic_function_by_id, make_from_module): New functions. (gfc_find_function, gfc_find_subroutine, gfc_generic_intrinsic, gfc_specific_intrinsic): Don't return module intrinsics. (add_functions): Add compiler_options, compiler_version. (gfc_intrinsic_func_interface): Also lookup symbol by ISYM ID. * symbol.c (std_for_isocbinding_symbol): Add version check for NAMED_FUNCTIONS. * iso-fortran-env.def: Add compiler_options, compiler_version. * iso-c-binding.def: Add c_sizeof. * gfortran.h (gfc_intrinsic_sym): Add from_module:1. (iso_c_binding_symbol, iso_fortran_env_symbol): Add NAMED_FUNCTIONS. (gfc_intrinsic_function_by_id): New prototype. * module.c (create_intrinsic_function): New function. (import_iso_c_binding_module, use_iso_fortran_env_module): Use it. * trans-types.c (init_c_interop_kinds): Add NAMED_FUNCTIONS. * resolve.c (resolve_intrinsic): Try also to resolve intrinsics by ISYM ID. * simplify.c (gfc_simplify_compiler_options, gfc_simplify_compiler_version): New functions. 2010-09-27 Tobias Burnus <burnus@net-b.de> PR fortran/40569 PR fortran/40568 * gfortran.dg/storage_size_2.f08: Fix test. * gfortran.dg/c_sizeof_1.f90: Fix test. * gfortran.dg/c_sizeof_2.f90: Update dg-error. * gfortran.dg/c_sizeof_3.f90: New. * gfortran.dg/c_sizeof_4.f90: New. * gfortran.dg/iso_c_binding_compiler_1.f90: New. * gfortran.dg/iso_c_binding_compiler_2.f90: New. From-SVN: r164639
2010-08-21re PR fortran/36158 (Transformational function BESSEL_YN(n1,n2,x) and ↵Tobias Burnus1-0/+1
BESSEL_JN missing) 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. From-SVN: r163440
2010-08-19re PR fortran/45290 ([F08] pointer initialization)Janus Weil1-6/+7
2010-08-19 Janus Weil <janus@gcc.gnu.org> PR fortran/45290 * gfortran.h (gfc_add_save): Modified prototype. * decl.c (add_init_expr_to_sym): Defer checking of proc pointer init. (match_pointer_init): New function to match F08 pointer initialization. (variable_decl,match_procedure_decl,match_ppc_decl): Use 'match_pointer_init'. (match_attr_spec): Module variables are implicitly SAVE. (gfc_match_save): Modified call to 'gfc_add_save'. * expr.c (gfc_check_assign_symbol): Extra checks for pointer initialization. * primary.c (gfc_variable_attr): Handle SAVE attribute. * resolve.c (resolve_structure_cons): Add new argument and do pointer initialization checks. (gfc_resolve_expr): Modified call to 'resolve_structure_cons'. (resolve_values): Call 'resolve_structure_cons' directly with init arg. (resolve_fl_variable): Handle SAVE_IMPLICIT. * symbol.c (gfc_add_save,gfc_copy_attr,save_symbol): Handle SAVE_IMPLICIT. * trans-decl.c (gfc_create_module_variable): Module variables with TARGET can already exist. * trans-expr.c (gfc_conv_variable): Check for 'current_function_decl'. (gfc_conv_initializer): Implement non-NULL pointer initialization. 2010-08-19 Janus Weil <janus@gcc.gnu.org> PR fortran/45290 * gfortran.dg/proc_ptr_comp_3.f90: Modified. * gfortran.dg/pointer_init_2.f90: New. * gfortran.dg/pointer_init_3.f90: New. * gfortran.dg/pointer_init_4.f90: New. From-SVN: r163356
2010-08-17re PR fortran/38936 ([F03] ASSOCIATE construct / improved SELECT TYPE (a=>expr))Daniel Kraft1-0/+20
2010-08-17 Daniel Kraft <d@domob.eu> PR fortran/38936 * gfortran.h (struct gfc_association_list): New member `where'. (gfc_is_associate_pointer) New method. * match.c (gfc_match_associate): Remember locus for each associate name matched and do not try to set variable flag. * parse.c (parse_associate): Use remembered locus for symbols. * primary.c (match_variable): Instead of variable-flag check for associate names set it for all such names used. * symbol.c (gfc_is_associate_pointer): New method. * resolve.c (resolve_block_construct): Don't generate assignments to give associate-names their values. (resolve_fl_var_and_proc): Allow associate-names to be deferred-shape. (resolve_symbol): Set some more attributes for associate variables, set variable flag here and check it and don't try to build an explicitely shaped array-spec for array associate variables. * trans-expr.c (gfc_conv_variable): Dereference in case of association to scalar variable. * trans-types.c (gfc_is_nodesc_array): Handle array association symbols. (gfc_sym_type): Return pointer type for association to scalar vars. * trans-decl.c (gfc_get_symbol_decl): Defer association symbols. (trans_associate_var): New method. (gfc_trans_deferred_vars): Handle association symbols. 2010-08-17 Daniel Kraft <d@domob.eu> PR fortran/38936 * gfortran.dg/associate_1.f03: Extended to test newly supported features like association to variables. * gfortran.dg/associate_3.f03: Removed check for illegal change of associate-name here... * gfortran.dg/associate_5.f03: ...and added it here. * gfortran.dg/associate_6.f03: No longer XFAIL'ed. * gfortran.dg/associate_7.f03: New test. From-SVN: r163295
2010-08-15re PR fortran/38936 ([F03] ASSOCIATE construct / improved SELECT TYPE (a=>expr))Daniel Kraft1-0/+16
2010-08-15 Daniel Kraft <d@domob.eu> PR fortran/38936 * gfortran.h (gfc_find_proc_namespace): New method. * expr.c (gfc_build_intrinsic_call): No need to build symtree messing around with namespace. * symbol.c (gfc_find_proc_namespace): New method. * trans-decl.c (gfc_build_qualified_array): Use it for correct value of nest. * primary.c (gfc_match_varspec): Handle associate-names as arrays. * parse.c (parse_associate): Removed assignment-generation here... * resolve.c (resolve_block_construct): ...and added it here. (resolve_variable): Handle names that are arrays but were not parsed as such because of association. (resolve_code): Fix BLOCK resolution. (resolve_symbol): Generate array-spec for associate-names. 2010-08-15 Daniel Kraft <d@domob.eu> PR fortran/38936 * gfortran.dg/associate_1.f03: Enable test for array expressions. * gfortran.dg/associate_3.f03: Clarify comment. * gfortran.dg/associate_5.f03: New test. * gfortran.dg/associate_6.f03: New test. From-SVN: r163268
2010-08-04re PR fortran/42051 ([OOP] ICE on array-valued function with CLASS formal ↵Mikael Morin1-7/+5
argument) 2010-08-04 Mikael Morin <mikael@gcc.gnu.org> PR fortran/42051 PR fortran/44064 * symbol.c (changed_syms): Made static again. (gfc_symbol_state): Don't conditionalize on GFC_DEBUG. Changed conditional internal error into assert. Rename function to ... (gfc_enforce_clean_symbol_state): ... this. * gfortran.h (gfc_symbol_state, gfc_enforce_clean_symbol_state): Rename the former to the latter. * parse.c (decode_statement, decode_omp_directive, decode_gcc_attribute): Update callers accordingly. Don't conditionalize on GFC_DEBUG. (changed_syms): Remove declaration. (next_statement): Use gfc_enforce_clean_symbol_state. From-SVN: r162865
2010-08-02re PR fortran/42051 ([OOP] ICE on array-valued function with CLASS formal ↵Mikael Morin1-0/+19
argument) 2010-08-02 Mikael Morin <mikael@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org> PR fortran/42051 PR fortran/44064 PR fortran/45151 * intrinsic.c (gfc_get_intrinsic_sub_symbol): Commit changed symbol. * symbol.c (gen_cptr_param, gen_fptr_param, gen_shape_param, gfc_copy_formal_args, gfc_copy_formal_args_intr, gfc_copy_formal_args_ppc, generate_isocbinding_symbol): Ditto. * parse.c (parse_derived_contains, parse_spec, parse_progunit): Call reject_statement in case of error. (match_deferred_characteritics): Call gfc_undo_symbols in case match fails. Co-Authored-By: Janus Weil <janus@gcc.gnu.org> From-SVN: r162821
2010-07-31re PR fortran/42051 ([OOP] ICE on array-valued function with CLASS formal ↵Mikael Morin1-1/+1
argument) 2010-07-31 Mikael Morin <mikael@gcc.gnu.org> PR fortran/42051 PR fortran/44064 * symbol.c (changed_syms): Made non-static. * parse.c (changed_syms): Declare new external. (next_statement): Assert changed_syms is NULL at the beginning. From-SVN: r162776
2010-07-30gfortran.h (gfc_release_symbol): New prototype.Mikael Morin1-35/+28
2010-07-30 Mikael Morin <mikael@gcc.gnu.org> * gfortran.h (gfc_release_symbol): New prototype. * symbol.c (gfc_release_symbol): New. Code taken from free_sym_tree. (gfc_undo_symbols, free_sym_tree, gfc_free_finalizer): Use gfc_release_symbol. * parse.c (gfc_fixup_sibling_symbols): Ditto. * resolve.c (resolve_symbol): Ditto. From-SVN: r162719
2010-07-23re PR fortran/44709 (BLOCK and GOTO/EXIT/CYCLE)Daniel Kraft1-0/+21
2010-07-23 Daniel Kraft <d@domob.eu> PR fortran/44709 * gfortran.h (gfc_find_symtree_in_proc): New method. * symbol.c (gfc_find_symtree_in_proc): New method. * match.c (match_exit_cycle): Look for loop name also in parent namespaces within current procedure. 2010-07-23 Daniel Kraft <d@domob.eu> PR fortran/44709 * gfortran.dg/exit_1.f08: New test. * gfortran.dg/exit_2.f08: New test. From-SVN: r162450
2010-07-22re PR fortran/45019 (Aliasing of TARGET dummy argument not detected correctly)Tobias Burnus1-0/+11
2010-07-22 Tobias Burnus <burnus@net-b.de> PR fortran/45019 * dependency.c (gfc_check_dependency): Add argument alising * check. * symbol.c (gfc_symbols_could_alias): Add argument alising * check. 2010-07-22 Tobias Burnus <burnus@net-b.de> PR fortran/45019 * gfortran.dg/aliasing_dummy_5.f90: New. From-SVN: r162410
2010-06-21re PR fortran/40632 (Support F2008's contiguous attribute)Tobias Burnus1-1/+20
2010-06-20 Tobias Burnus <burnus@net-b.de> PR fortran/40632 * interface.c (compare_parameter): Add gfc_is_simply_contiguous checks. * symbol.c (gfc_add_contiguous): New function. (gfc_copy_attr, check_conflict): Handle contiguous attribute. * decl.c (match_attr_spec): Ditto. (gfc_match_contiguous): New function. * resolve.c (resolve_fl_derived, resolve_symbol): Handle contiguous. * gfortran.h (symbol_attribute): Add contiguous. (gfc_is_simply_contiguous): Add prototype. (gfc_add_contiguous): Add prototype. * match.h (gfc_match_contiguous): Add prototype. * parse.c (decode_specification_statement, decode_statement): Handle contiguous attribute. * expr.c (gfc_is_simply_contiguous): New function. * dump-parse-tree.c (show_attr): Handle contiguous. * module.c (ab_attribute, attr_bits, mio_symbol_attribute): Ditto. * trans-expr.c (gfc_add_interface_mapping): Copy attr.contiguous. * trans-array.c (gfc_conv_descriptor_stride_get, gfc_conv_array_parameter): Handle contiguous arrays. * trans-types.c (gfc_build_array_type, gfc_build_array_type, gfc_sym_type, gfc_get_derived_type, gfc_get_array_descr_info): Ditto. * trans.h (gfc_array_kind): Ditto. * trans-decl.c (gfc_get_symbol_decl): Ditto. 2010-06-20 Tobias Burnus <burnus@net-b.de> PR fortran/40632 * gfortran.dg/contiguous_1.f90: New. * gfortran.dg/contiguous_2.f90: New. * gfortran.dg/contiguous_3.f90: New. From-SVN: r161079
2010-06-16re PR fortran/44549 ([OOP][F2008] Type-bound procedure: bogus error from ↵Janus Weil1-1/+3
list after PROCEDURE) 2010-06-16 Janus Weil <janus@gcc.gnu.org> PR fortran/44549 * gfortran.h (gfc_get_typebound_proc): Modified Prototype. * decl.c (match_procedure_in_type): Give a unique gfc_typebound_proc structure to each procedure in a procedure list. * module.c (mio_typebound_proc): Add NULL argument to 'gfc_get_typebound_proc'. * symbol.c (gfc_get_typebound_proc): Add a new argument, which is used to initialize the new structure. 2010-06-16 Janus Weil <janus@gcc.gnu.org> PR fortran/44549 * gfortran.dg/typebound_proc_16.f03: New. From-SVN: r160834
2010-06-10re PR fortran/38936 ([F03] ASSOCIATE construct / improved SELECT TYPE (a=>expr))Daniel Kraft1-0/+1
2010-06-10 Daniel Kraft <d@domob.eu> PR fortran/38936 * gfortran.h (enum gfc_statement): Add ST_ASSOCIATE, ST_END_ASSOCIATE. (struct gfc_symbol): New field `assoc'. (struct gfc_association_list): New struct. (struct gfc_code): New struct `block' in union, move `ns' there and add association list. (gfc_free_association_list): New method. (gfc_has_vector_subscript): Made public; * match.h (gfc_match_associate): New method. * parse.h (enum gfc_compile_state): Add COMP_ASSOCIATE. * decl.c (gfc_match_end): Handle ST_END_ASSOCIATE. * interface.c (gfc_has_vector_subscript): Made public. (compare_actual_formal): Rename `has_vector_subscript' accordingly. * match.c (gfc_match_associate): New method. (gfc_match_select_type): Change reference to gfc_code's `ns' field. * primary.c (match_variable): Don't allow names associated to expr here. * parse.c (decode_statement): Try matching ASSOCIATE statement. (case_exec_markers, case_end): Add ASSOCIATE statement. (gfc_ascii_statement): Hande ST_ASSOCIATE and ST_END_ASSOCIATE. (parse_associate): New method. (parse_executable): Handle ST_ASSOCIATE. (parse_block_construct): Change reference to gfc_code's `ns' field. * resolve.c (resolve_select_type): Ditto. (resolve_code): Ditto. (resolve_block_construct): Ditto and add comment. (resolve_select_type): Set association list in generated BLOCK to NULL. (resolve_symbol): Resolve associate names. * st.c (gfc_free_statement): Change reference to gfc_code's `ns' field and free association list. (gfc_free_association_list): New method. * symbol.c (gfc_new_symbol): NULL new field `assoc'. * trans-stmt.c (gfc_trans_block_construct): Change reference to gfc_code's `ns' field. 2010-06-10 Daniel Kraft <d@domob.eu> PR fortran/38936 * gfortran.dg/associate_1.f03: New test. * gfortran.dg/associate_2.f95: New test. * gfortran.dg/associate_3.f03: New test. * gfortran.dg/associate_4.f08: New test. From-SVN: r160550
2010-06-092010-06-09 Steven G. KarglSteven G. Kargl1-1/+0
* gfortran.dg/data_namelist_conflict.f90: New test. 2010-06-09 Steven G. Kargl * fortran/symbol.c (check_conflict): Remove an invalid conflict check. From-SVN: r160503
2010-06-08re PR fortran/44446 (Error with protected pocedure pointer)Tobias Burnus1-2/+0
2010-06-07 Tobias Burnus <burnus@net-b.de> PR fortran/44446 * symbol.c (check_conflict): Move protected--external/procedure check ... * resolve.c (resolve_select_type): ... to the resolution stage. 2010-06-07 Tobias Burnus <burnus@net-b.de> PR fortran/44446 * gfortran.dg/proc_ptr_27.f90: New. From-SVN: r160424
2010-05-30gfortran.h (CLASS_DATA): New macro for accessing the $data component of a ↵Janus Weil1-22/+4
class container. 2010-05-30 Janus Weil <janus@gcc.gnu.org> * gcc/fortran/gfortran.h (CLASS_DATA): New macro for accessing the $data component of a class container. * gcc/fortran/decl.c (attr_decl1): Use macro CLASS_DATA. * gcc/fortran/expr.c (gfc_check_pointer_assign,gfc_check_assign_symbol, gfc_has_ultimate_allocatable,gfc_has_ultimate_pointer): Ditto. * gcc/fortran/interface.c (matching_typebound_op): Ditto. * gcc/fortran/match.c (gfc_match_allocate, gfc_match_deallocate): Ditto. * gcc/fortran/parse.c (parse_derived): Ditto. * gcc/fortran/primary.c (gfc_match_varspec, gfc_variable_attr, gfc_expr_attr): Ditto. * gcc/fortran/resolve.c (resolve_structure_cons, find_array_spec, resolve_deallocate_expr, resolve_allocate_expr, resolve_select_type, resolve_fl_var_and_proc, resolve_typebound_procedure, resolve_fl_derived): Ditto. * gcc/fortran/symbol.c (gfc_type_compatible): Restructured. * gcc/fortran/trans-array.c (structure_alloc_comps): Use macro CLASS_DATA. * gcc/fortran/trans-decl.c (gfc_get_symbol_decl, gfc_trans_deferred_vars): Ditto. * gcc/fortran/trans-stmt.c (gfc_trans_allocate): Ditto. From-SVN: r160060
2010-05-17class.c (gfc_add_component_ref,gfc_class_null_initializer, [...]): Moved ↵Janus Weil1-691/+0
here from other places. 2010-05-17 Janus Weil <janus@gcc.gnu.org> * class.c (gfc_add_component_ref,gfc_class_null_initializer, gfc_build_class_symbol,add_proc_component,add_proc_comps, add_procs_to_declared_vtab1,copy_vtab_proc_comps, add_procs_to_declared_vtab,add_generic_specifics, add_generics_to_declared_vtab,gfc_find_derived_vtab, find_typebound_proc_uop,gfc_find_typebound_proc, gfc_find_typebound_user_op,gfc_find_typebound_intrinsic_op, gfc_get_tbp_symtree): Moved here from other places. * expr.c (gfc_add_component_ref,gfc_class_null_initializer): Move to class.c. * gfortran.h (gfc_build_class_symbol,gfc_find_derived_vtab, gfc_find_typebound_proc,gfc_find_typebound_user_op, gfc_find_typebound_intrinsic_op,gfc_get_tbp_symtree, gfc_add_component_ref, gfc_class_null_initializer): Moved to class.c. * Make-lang.in: Add class.o. * symbol.c (gfc_build_class_symbol,add_proc_component,add_proc_comps, add_procs_to_declared_vtab1,copy_vtab_proc_comps, add_procs_to_declared_vtab,add_generic_specifics, add_generics_to_declared_vtab,gfc_find_derived_vtab, find_typebound_proc_uop,gfc_find_typebound_proc, gfc_find_typebound_user_op,gfc_find_typebound_intrinsic_op, gfc_get_tbp_symtree): Move to class.c. From-SVN: r159506
2010-05-15re PR fortran/43207 ([OOP] invalid (pointer) assignment to and from abstract ↵Janus Weil1-6/+6
non-polymorphic expressions) 2010-05-15 Janus Weil <janus@gcc.gnu.org> PR fortran/43207 PR fortran/43969 * gfortran.h (gfc_class_null_initializer): New prototype. * expr.c (gfc_class_null_initializer): New function to build a NULL initializer for CLASS pointers. * symbol.c (gfc_build_class_symbol): Modify internal naming of class containers. Remove default NULL initialization of $data component. * trans.c (gfc_allocate_array_with_status): Fix wording of an error message. * trans-expr.c (gfc_conv_initializer,gfc_trans_subcomponent_assign): Use new function 'gfc_class_null_initializer'. * trans-intrinsic.c (gfc_conv_allocated): Handle allocatable scalar class variables. 2010-05-15 Janus Weil <janus@gcc.gnu.org> PR fortran/43207 PR fortran/43969 * gfortran.dg/class_18.f03: New. * gfortran.dg/class_19.f03: New. From-SVN: r159431
2010-05-05re PR fortran/43696 ([OOP] Bogus error: Passed-object dummy argument must ↵Janus Weil1-0/+2
not be POINTER) 2010-05-05 Janus Weil <janus@gcc.gnu.org> PR fortran/43696 * resolve.c (resolve_fl_derived): Some fixes for class variables. * symbol.c (gfc_build_class_symbol): Add separate class container for class pointers. 2010-05-05 Janus Weil <janus@gcc.gnu.org> PR fortran/43696 * gfortran.dg/class_17.f03: New. From-SVN: r159056
2010-04-29[multiple changes]Paul Thomas1-12/+361
2010-04-29 Janus Weil <janus@gcc.gnu.org> PR fortran/43896 * symbol.c (add_proc_component,copy_vtab_proc_comps): Remove initializers for PPC members of the vtabs. 2010-04-29 Janus Weil <janus@gcc.gnu.org> PR fortran/42274 * symbol.c (add_proc_component,add_proc_comps): Correctly set the 'ppc' attribute for all PPC members of the vtypes. (copy_vtab_proc_comps): Copy the correct interface. * trans.h (gfc_trans_assign_vtab_procs): Modified prototype. * trans-expr.c (gfc_trans_assign_vtab_procs): Pass the derived type as a dummy argument and make sure all PPC members of the vtab are initialized correctly. (gfc_conv_derived_to_class,gfc_trans_class_assign): Additional argument in call to gfc_trans_assign_vtab_procs. * trans-stmt.c (gfc_trans_allocate): Ditto. 2010-04-29 Paul Thomas <pault@gcc.gnu.org> PR fortran/43326 * resolve.c (resolve_typebound_function): Renamed resolve_class_compcall.Do all the detection of class references here. (resolve_typebound_subroutine): resolve_class_typebound_call renamed. Otherwise same as resolve_typebound_function. (gfc_resolve_expr): Call resolve_typebound_function. (resolve_code): Call resolve_typebound_subroutine. 2010-04-29 Janus Weil <janus@gcc.gnu.org> PR fortran/43492 * resolve.c (resolve_typebound_generic_call): For CLASS methods pass back the specific symtree name, rather than the target name. 2010-04-29 Paul Thomas <pault@gcc.gnu.org> PR fortran/42353 * resolve.c (resolve_structure_cons): Make the initializer of the vtab component 'extends' the same type as the component. 2010-04-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/42680 * interface.c (check_interface1): Pass symbol name rather than NULL to gfc_compare_interfaces.(gfc_compare_interfaces): Add assert to trap MULL. (gfc_compare_derived_types): Revert previous change incorporated incorrectly during merge from trunk, r155778. * resolve.c (check_generic_tbp_ambiguity): Pass symbol name rather than NULL to gfc_compare_interfaces. * symbol.c (add_generic_specifics): Likewise. 2010-02-29 Janus Weil <janus@gcc.gnu.org> PR fortran/42353 * interface.c (gfc_compare_derived_types): Add condition for vtype. * symbol.c (gfc_find_derived_vtab): Sey access to private. (gfc_find_derived_vtab): Likewise. * module.c (ab_attribute): Add enumerator AB_VTAB. (mio_symbol_attribute): Use new attribute, AB_VTAB. (check_for_ambiguous): Likewise. 2010-04-29 Paul Thomas <pault@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org> PR fortran/41829 * trans-expr.c (select_class_proc): Remove function. (conv_function_val): Delete reference to previous. (gfc_conv_derived_to_class): Add second argument to the call to gfc_find_derived_vtab. (gfc_conv_structure): Exclude proc_pointer components when accessing $data field of class objects. (gfc_trans_assign_vtab_procs): New function. (gfc_trans_class_assign): Add second argument to the call to gfc_find_derived_vtab. * symbol.c (gfc_build_class_symbol): Add delayed_vtab arg and implement holding off searching for the vptr derived type. (add_proc_component): New function. (add_proc_comps): New function. (add_procs_to_declared_vtab1): New function. (copy_vtab_proc_comps): New function. (add_procs_to_declared_vtab): New function. (void add_generic_specifics): New function. (add_generics_to_declared_vtab): New function. (gfc_find_derived_vtab): Add second argument to the call to gfc_find_derived_vtab. Add the calls to add_procs_to_declared_vtab and add_generics_to_declared_vtab. * decl.c (build_sym, build_struct): Use new arg in calls to gfc_build_class_symbol. * gfortran.h : Add vtype bitfield to symbol_attr. Remove the definition of struct gfc_class_esym_list. Modify prototypes of gfc_build_class_symbol and gfc_find_derived_vtab. * trans-stmt.c (gfc_trans_allocate): Add second argument to the call to gfc_find_derived_vtab. * module.c : Add the vtype attribute. * trans.h : Add prototype for gfc_trans_assign_vtab_procs. * resolve.c (resolve_typebound_generic_call): Add second arg to pass along the generic name for class methods. (resolve_typebound_call): The same. (resolve_compcall): Use the second arg to carry the generic name from the above. Remove the reference to class_esym. (check_members, check_class_members, resolve_class_esym, hash_value_expr): Remove functions. (resolve_class_compcall, resolve_class_typebound_call): Modify to use vtable rather than member by member calls. (gfc_resolve_expr): Modify second arg in call to resolve_compcall. (resolve_select_type): Add second arg in call to gfc_find_derived_vtab. (resolve_code): Add second arg in call resolve_typebound_call. (resolve_fl_derived): Exclude vtypes from check for late procedure definitions. Likewise for checking of explicit interface and checking of pass arg. * iresolve.c (gfc_resolve_extends_type_of): Add second arg in calls to gfc_find_derived_vtab. * match.c (select_type_set_tmp): Use new arg in call to gfc_build_class_symbol. * trans-decl.c (gfc_get_symbol_decl): Complete vtable if necessary. * parse.c (endType): Finish incomplete classes. 2010-04-29 Janus Weil <janus@gcc.gnu.org> PR fortran/42274 * gfortran.dg/class_16.f03: New test. 2010-04-29 Janus Weil <janus@gcc.gnu.org> PR fortran/42274 * gfortran.dg/class_15.f03: New. 2010-04-29 Paul Thomas <pault@gcc.gnu.org> PR fortran/43326 * gfortran.dg/dynamic_dispatch_9.f03: New test. 2010-04-29 Janus Weil <janus@gcc.gnu.org> PR fortran/43492 * gfortran.dg/generic_22.f03 : New test. 2010-04-29 Paul Thomas <pault@gcc.gnu.org> PR fortran/42353 * gfortran.dg/class_14.f03: New test. 2010-04-29 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/42680 * gfortran.dg/interface_32.f90: New test. 2009-04-29 Paul Thomas <pault@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org> PR fortran/41829 * gfortran.dg/dynamic_dispatch_5.f03 : Change to "run". * gfortran.dg/dynamic_dispatch_7.f03 : New test. * gfortran.dg/dynamic_dispatch_8.f03 : New test. From-SVN: r158910
2010-04-13[multiple changes]Jerry DeLisle1-22/+22
2010-04-12 Jerry DeLisle <jvdelisle@gcc.gnu.org> * array.c (extract_element): Restore function from trunk. (gfc_get_array_element): Restore function from trunk. (gfc_expand_constructor): Restore check against flag_max_array_constructor. * constructor.c (node_copy_and_append): Delete unused. * gfortran.h: Delete comment and extra include. * constructor.h: Bump copyright and clean up TODO comments. * resolve.c: Whitespace. 2010-04-12 Daniel Franke <franke.daniel@gmail.com> * simplify.c (compute_dot_product): Replaced usage of ADVANCE macro with direct access access to elements. Adjusted prototype, fixed all callers. (gfc_simplify_dot_product): Removed duplicate check for zero-sized array. (gfc_simplify_matmul): Removed usage of ADVANCE macro. (gfc_simplify_spread): Removed workaround, directly insert elements at a given array position. (gfc_simplify_transpose): Likewise. (gfc_simplify_pack): Replaced usage of ADVANCE macro with corresponding function calls. (gfc_simplify_unpack): Likewise. 2010-04-12 Daniel Franke <franke.daniel@gmail.com> * simplify.c (only_convert_cmplx_boz): Renamed to ... (convert_boz): ... this and moved to start of file. (gfc_simplify_abs): Whitespace fix. (gfc_simplify_acos): Whitespace fix. (gfc_simplify_acosh): Whitespace fix. (gfc_simplify_aint): Whitespace fix. (gfc_simplify_dint): Whitespace fix. (gfc_simplify_anint): Whitespace fix. (gfc_simplify_and): Replaced if-gate by more common switch-over-type. (gfc_simplify_dnint): Whitespace fix. (gfc_simplify_asin): Whitespace fix. (gfc_simplify_asinh): Moved creation of result-expr out of switch. (gfc_simplify_atan): Likewise. (gfc_simplify_atanh): Whitespace fix. (gfc_simplify_atan2): Whitespace fix. (gfc_simplify_bessel_j0): Removed ATTRIBUTE_UNUSED. (gfc_simplify_bessel_j1): Likewise. (gfc_simplify_bessel_jn): Likewise. (gfc_simplify_bessel_y0): Likewise. (gfc_simplify_bessel_y1): Likewise. (gfc_simplify_bessel_yn): Likewise. (gfc_simplify_ceiling): Reorderd statements. (simplify_cmplx): Use convert_boz(), check for constant arguments. Whitespace fix. (gfc_simplify_cmplx): Use correct default kind. Removed check for constant arguments. (gfc_simplify_complex): Replaced if-gate. Removed check for constant arguments. (gfc_simplify_conjg): Whitespace fix. (gfc_simplify_cos): Whitespace fix. (gfc_simplify_cosh): Replaced if-gate by more common switch-over-type. (gfc_simplify_dcmplx): Removed check for constant arguments. (gfc_simplify_dble): Use convert_boz() and gfc_convert_constant(). (gfc_simplify_digits): Whitespace fix. (gfc_simplify_dim): Whitespace fix. (gfc_simplify_dprod): Reordered statements. (gfc_simplify_erf): Whitespace fix. (gfc_simplify_erfc): Whitespace fix. (gfc_simplify_epsilon): Whitespace fix. (gfc_simplify_exp): Whitespace fix. (gfc_simplify_exponent): Use convert_boz(). (gfc_simplify_floor): Reorderd statements. (gfc_simplify_gamma): Whitespace fix. (gfc_simplify_huge): Whitespace fix. (gfc_simplify_iand): Whitespace fix. (gfc_simplify_ieor): Whitespace fix. (simplify_intconv): Use gfc_convert_constant(). (gfc_simplify_int): Use simplify_intconv(). (gfc_simplify_int2): Reorderd statements. (gfc_simplify_idint): Reorderd statements. (gfc_simplify_ior): Whitespace fix. (gfc_simplify_ishftc): Removed duplicate type check. (gfc_simplify_len): Use range_check() instead of manual range check. (gfc_simplify_lgamma): Removed ATTRIBUTE_UNUSED. Whitespace fix. (gfc_simplify_log): Whitespace fix. (gfc_simplify_log10): Whitespace fix. (gfc_simplify_minval): Whitespace fix. (gfc_simplify_maxval): Whitespace fix. (gfc_simplify_mod): Whitespace fix. (gfc_simplify_modulo): Whitespace fix. (simplify_nint): Reorderd statements. (gfc_simplify_not): Whitespace fix. (gfc_simplify_or): Replaced if-gate by more common switch-over-type. (gfc_simplify_radix): Removed unused result-variable. Whitespace fix. (gfc_simplify_range): Removed unused result-variable. Whitespace fix. (gfc_simplify_real): Use convert_boz() and gfc_convert_constant(). (gfc_simplify_realpart): Whitespace fix. (gfc_simplify_selected_char_kind): Removed unused result-variable. (gfc_simplify_selected_int_kind): Removed unused result-variable. (gfc_simplify_selected_real_kind): Removed unused result-variable. (gfc_simplify_sign): Whitespace fix. (gfc_simplify_sin): Whitespace fix. (gfc_simplify_sinh): Replaced if-gate by more common switch-over-type. (gfc_simplify_sqrt): Avoided goto by inlining check. Whitespace fix. (gfc_simplify_tan): Replaced if-gate by more common switch-over-type. (gfc_simplify_tanh): Replaced if-gate by more common switch-over-type. (gfc_simplify_xor): Replaced if-gate by more common switch-over-type. 2010-04-12 Daniel Franke <franke.daniel@gmail.com> * gfortran.h (gfc_start_constructor): Removed. (gfc_get_array_element): Removed. * array.c (gfc_start_constructor): Removed, use gfc_get_array_expr instead. Fixed all callers. (extract_element): Removed. (gfc_expand_constructor): Temporarily removed check for max-array-constructor. Will be re-introduced later if still required. (gfc_get_array_element): Removed, use gfc_constructor_lookup_expr instead. Fixed all callers. * expr.c (find_array_section): Replaced manual lookup of elements by gfc_constructor_lookup. 2010-04-12 Daniel Franke <franke.daniel@gmail.com> * gfortran.h (gfc_get_null_expr): New prototype. (gfc_get_operator_expr): New prototype. (gfc_get_character_expr): New prototype. (gfc_get_iokind_expr): New prototype. * expr.c (gfc_get_null_expr): New. (gfc_get_character_expr): New. (gfc_get_iokind_expr): New. (gfc_get_operator_expr): Moved here from matchexp.c (build_node). * matchexp.c (build_node): Renamed and moved to expr.c (gfc_get_operator_expr). Reordered arguments to match other functions. Fixed all callers. (gfc_get_parentheses): Use specific function to build expr. * array.c (gfc_match_array_constructor): Likewise. * arith.c (eval_intrinsic): Likewise. (gfc_hollerith2int): Likewise. (gfc_hollerith2real): Likewise. (gfc_hollerith2complex): Likewise. (gfc_hollerith2logical): Likewise. * data.c (create_character_intializer): Likewise. * decl.c (gfc_match_null): Likewise. (enum_initializer): Likewise. * io.c (gfc_match_format): Likewise. (match_io): Likewise. * match.c (gfc_match_nullify): Likewise. * primary.c (match_string_constant): Likewise. (match_logical_constant): Likewise. (build_actual_constructor): Likewise. * resolve.c (build_default_init_expr): Likewise. * symbol.c (generate_isocbinding_symbol): Likewise. (gfc_build_class_symbol): Likewise. (gfc_find_derived_vtab): Likewise. * simplify.c (simplify_achar_char): Likewise. (gfc_simplify_adjustl): Likewise. (gfc_simplify_adjustr): Likewise. (gfc_simplify_and): Likewise. (gfc_simplify_bit_size): Likewise. (gfc_simplify_is_iostat_end): Likewise. (gfc_simplify_is_iostat_eor): Likewise. (gfc_simplify_isnan): Likewise. (simplify_bound): Likewise. (gfc_simplify_leadz): Likewise. (gfc_simplify_len_trim): Likewise. (gfc_simplify_logical): Likewise. (gfc_simplify_maxexponent): Likewise. (gfc_simplify_minexponent): Likewise. (gfc_simplify_new_line): Likewise. (gfc_simplify_null): Likewise. (gfc_simplify_or): Likewise. (gfc_simplify_precision): Likewise. (gfc_simplify_repeat): Likewise. (gfc_simplify_scan): Likewise. (gfc_simplify_size): Likewise. (gfc_simplify_trailz): Likewise. (gfc_simplify_trim): Likewise. (gfc_simplify_verify): Likewise. (gfc_simplify_xor): Likewise. * trans-io.c (build_dt): Likewise. (gfc_new_nml_name_expr): Removed. 2010-04-12 Daniel Franke <franke.daniel@gmail.com> * arith.h (gfc_constant_result): Removed prototype. * constructor.h (gfc_build_array_expr): Removed prototype. (gfc_build_structure_constructor_expr): Removed prototype. * gfortran.h (gfc_int_expr): Removed prototype. (gfc_logical_expr): Removed prototype. (gfc_get_array_expr): New prototype. (gfc_get_structure_constructor_expr): New prototype. (gfc_get_constant_expr): New prototype. (gfc_get_int_expr): New prototype. (gfc_get_logical_expr): New prototype. * arith.c (gfc_constant_result): Moved and renamed to expr.c (gfc_get_constant_expr). Fixed all callers. * constructor.c (gfc_build_array_expr): Moved and renamed to expr.c (gfc_get_array_expr). Split gfc_typespec argument to type and kind. Fixed all callers. (gfc_build_structure_constructor_expr): Moved and renamed to expr.c (gfc_get_structure_constructor_expr). Split gfc_typespec argument to type and kind. Fixed all callers. * expr.c (gfc_logical_expr): Renamed to ... (gfc_get_logical_expr): ... this. Added kind argument. Fixed all callers. (gfc_int_expr): Renamed to ... (gfc_get_int_expr): ... this. Added kind and where arguments. Fixed all callers. (gfc_get_constant_expr): New. (gfc_get_array_expr): New. (gfc_get_structure_constructor_expr): New. * simplify.c (int_expr_with_kind): Removed, callers use gfc_get_int_expr instead. 2010-04-12 Daniel Franke <franke.daniel@gmail.com> * constructor.h: New. * constructor.c: New. * Make-lang.in: Add new files to F95_PARSER_OBJS. * arith.c (reducy_unary): Use constructor API. (reduce_binary_ac): Likewise. (reduce_binary_ca): Likewise. (reduce_binary_aa): Likewise. * check.c (gfc_check_pack): Likewise. (gfc_check_reshape): Likewise. (gfc_check_unpack): Likewise. * decl.c (add_init_expr_to_sym): Likewise. (build_struct): Likewise. * dependency.c (gfc_check_dependency): Likewise. (contains_forall_index_p): Likewise. * dump-parse-tree.c (show_constructor): Likewise. * expr.c (free_expr0): Likewise. (gfc_copy_expr): Likewise. (gfc_is_constant_expr): Likewise. (simplify_constructor): Likewise. (find_array_element): Likewise. (find_component_ref): Likewise. (find_array_section): Likewise. (find_substring_ref): Likewise. (simplify_const_ref): Likewise. (scalarize_intrinsic_call): Likewise. (check_alloc_comp_init): Likewise. (gfc_default_initializer): Likewise. (gfc_traverse_expr): Likewise. * iresolve.c (check_charlen_present): Likewise. (gfc_resolve_reshape): Likewise. (gfc_resolve_transfer): Likewise. * module.c (mio_constructor): Likewise. * primary.c (build_actual_constructor): Likewise. (gfc_match_structure_constructor): Likewise. * resolve.c (resolve_structure_cons): Likewise. * simplify.c (is_constant_array_expr): Likewise. (init_result_expr): Likewise. (transformational_result): Likewise. (simplify_transformation_to_scalar): Likewise. (simplify_transformation_to_array): Likewise. (gfc_simplify_dot_product): Likewise. (simplify_bound): Likewise. (simplify_matmul): Likewise. (simplify_minval_maxval): Likewise. (gfc_simplify_pack): Likewise. (gfc_simplify_reshape): Likewise. (gfc_simplify_shape): Likewise. (gfc_simplify_spread): Likewise. (gfc_simplify_transpose): Likewise. (gfc_simplify_unpack): Likewise.q (gfc_convert_constant): Likewise. (gfc_convert_char_constant): Likewise. * target-memory.c (size_array): Likewise. (encode_array): Likewise. (encode_derived): Likewise. (interpret_array): Likewise. (gfc_interpret_derived): Likewise. (expr_to_char): Likewise. (gfc_merge_initializers): Likewise. * trans-array.c (gfc_get_array_constructor_size): Likewise. (gfc_trans_array_constructor_value): Likewise. (get_array_ctor_strlen): Likewise. (gfc_constant_array_constructor_p): Likewise. (gfc_build_constant_array_constructor): Likewise. (gfc_trans_array_constructor): Likewise. (gfc_conv_array_initializer): Likewise. * trans-decl.c (check_constant_initializer): Likewise. * trans-expr.c (flatten_array_ctors_without_strlen): Likewise. (gfc_apply_interface_mapping_to_cons): Likewise. (gfc_trans_structure_assign): Likewise. (gfc_conv_structure): Likewise. * array.c (check_duplicate_iterator): Likewise. (match_array_list): Likewise. (match_array_cons_element): Likewise. (gfc_match_array_constructor): Likewise. (check_constructor_type): Likewise. (check_constructor): Likewise. (expand): Likewise. (expand_constructor): Likewise. (extract_element): Likewise. (gfc_expanded_ac): Likewise. (resolve_array_list): Likewise. (gfc_resolve_character_array_constructor): Likewise. (copy_iterator): Renamed to ... (gfc_copy_iterator): ... this. (gfc_append_constructor): Removed. (gfc_insert_constructor): Removed unused function. (gfc_get_constructor): Removed. (gfc_free_constructor): Removed. (qgfc_copy_constructor): Removed. * gfortran.h (struct gfc_expr): Removed member 'con_by_offset'. Removed all references. Replaced constructor list by splay-tree. (struct gfc_constructor): Removed member 'next', moved 'offset' from the inner struct, added member 'base'. (gfc_append_constructor): Removed prototype. (gfc_insert_constructor): Removed prototype. (gfc_get_constructor): Removed prototype. (gfc_free_constructor): Removed prototype. (qgfc_copy_constructor): Removed prototype. (gfc_copy_iterator): New prototype. * trans-array.h (gfc_constant_array_constructor_p): Adjusted prototype. From-SVN: r158253
2010-04-06re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])Tobias Burnus1-2/+43
2010-04-06 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * array.c (gfc_free_array_spec,gfc_resolve_array_spec, match_array_element_spec,gfc_copy_array_spec, gfc_compare_array_spec): Include corank. (match_array_element_spec,gfc_set_array_spec): Support codimension. * decl.c (build_sym,build_struct,variable_decl, match_attr_spec,attr_decl1,cray_pointer_decl, gfc_match_volatile): Add codimension. (gfc_match_codimension): New function. * dump-parse-tree.c (show_array_spec,show_attr): Support * codimension. * gfortran.h (symbol_attribute,gfc_array_spec): Ditto. (gfc_add_codimension): New function prototype. * match.h (gfc_match_codimension): New function prototype. (gfc_match_array_spec): Update prototype * match.c (gfc_match_common): Update gfc_match_array_spec call. * module.c (MOD_VERSION): Bump. (mio_symbol_attribute): Support coarray attributes. (mio_array_spec): Add corank support. * parse.c (decode_specification_statement,decode_statement, parse_derived): Add coarray support. * resolve.c (resolve_formal_arglist, was_declared, is_non_constant_shape_array, resolve_fl_variable, resolve_fl_derived, resolve_symbol): Add coarray support. * symbol.c (check_conflict, gfc_add_volatile, gfc_copy_attr, gfc_build_class_symbol): Add coarray support. (gfc_add_codimension): New function. 2010-04-06 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * gfortran.dg/coarray_4.f90: New test. * gfortran.dg/coarray_5.f90: New test. * gfortran.dg/coarray_6.f90: New test. From-SVN: r158012
2010-04-01ioparm.def: Update copyright.Paul Thomas1-1/+2
2010-04-01 Paul Thomas <pault@gcc.gnu.org> * ioparm.def : Update copyright. * lang.opt : ditto * trans-array.c : ditto * trans-array.h : ditto * expr.c: ditto * trans-types.c: ditto * dependency.c : ditto * gfortran.h : ditto * options.c : ditto * trans-io.c : ditto * trans-intrinsic.c : ditto * libgfortran.h : ditto * invoke.texi : ditto * intrinsic.texi : ditto * trans.c : ditto * trans.h : ditto * intrinsic.c : ditto * interface.c : ditto * iresolve.c : ditto * trans-stmt.c : ditto * trans-stmt.h : ditto * parse,c : ditto * match.h : ditto * error.c : ditto From-SVN: r157923
2010-03-102010-03-10 Tobias Burnus <burnus@net-b.deTobias Burnus1-0/+2
PR fortran/43303 * symbol.c (get_iso_c_sym): Set sym->result. 2010-03-10 Tobias Burnus <burnus@net-b.de PR fortran/43303 * gfortran.dg/c_assoc_3.f90: New test. From-SVN: r157364
2010-01-19re PR fortran/42545 (type extension: parent component has wrong accessibility)Janus Weil1-11/+5
gcc/fortran/ 2010-01-19 Janus Weil <janus@gcc.gnu.org> PR fortran/42545 * resolve.c (resolve_fl_derived): Set the accessibility of the parent component for extended types. * symbol.c (gfc_find_component): Remove a wrongly-worded error message and take care of parent component accessibility. gcc/testsuite/ 2010-01-19 Janus Weil <janus@gcc.gnu.org> PR fortran/42545 * gfortran.dg/extends_6.f03: Modified an error message. * gfortran.dg/extends_10.f03: New test. * gfortran.dg/private_type_6.f03: Modified an error message. * gfortran.dg/structure_constructor_8.f03: Ditto. From-SVN: r156040
2010-01-09[multiple changes]Tobias Burnus1-5/+5
2010-01-09 Tobias Burnus <burnus@net-b.de> PR fortran/41298 * trans-expr.c (gfc_trans_structure_assign): Handle c_null_(fun)ptr. * symbol.c (gen_special_c_interop_ptr): Add NULL_EXPR to the constructor for c_null_(fun)ptr. * resolve.c (resolve_structure_cons): Add special case for c_null_(fun)ptr. 2010-01-09 Tobias Burnus <burnus@net-b.de> PR fortran/41298 * gfortran.dg/c_ptr_tests_14.f90: New test. From-SVN: r155755
2010-01-08re PR fortran/25829 ([F03] Asynchronous IO support)Tobias Burnus1-1/+32
2010-01-08 Tobias Burnus <burnus@net-b.de PR/fortran 25829 * symbol.c (check_conflict, gfc_copy_attr): Add ASYNCHRONOUS support. (gfc_add_asynchronous): New function. * decl.c (match_attr_spec): Add ASYNCHRONOUS support. (gfc_match_asynchronous): New function. * dump-parse-tree.c (show_attr): Add ASYNCHRONOUS support. * gfortran.h (symbol_attribute): New ASYNCHRONOUS bit. (gfc_add_asynchronous): New Prototype. * module.c (ab_attribute, mio_symbol_attribute): Add ASYNCHRONOUS support. * resolve.c (was_declared): Ditto. * match.h (gfc_match_asynchronous): New prototype. * parse.c (decode_specification_statement,decode_statement): Add ASYNCHRONOUS support. 2010-01-08 Tobias Burnus <burnus@net-b.de PR/fortran 25829 * gfortran.dg/asynchronous_1.f90: New test. * gfortran.dg/asynchronous_2.f90: New test. * gfortran.dg/conflicts.f90: Update error message. From-SVN: r155732
2009-12-29re PR fortran/42353 ([OOP] Bogus Error: Name 'vtype$...' at (1) is an ↵Janus Weil1-0/+2
ambiguous reference ...) gcc/fortran/ 2009-12-28 Janus Weil <janus@gcc.gnu.org> PR fortran/42353 * symbol.c (gfc_find_derived_vtab): Make vtabs and vtypes private. gcc/testsuite/ 2009-12-28 Janus Weil <janus@gcc.gnu.org> PR fortran/42353 * gfortran.dg/class_13.f03: New test. From-SVN: r155494
2009-12-11re PR fortran/42335 ([OOP] ICE on CLASS IS (bad_identifier))Janus Weil1-1/+1
gcc/fortran/ 2009-12-11 Janus Weil <janus@gcc.gnu.org> PR fortran/42335 * symbol.c (select_type_insert_tmp): Add an extra check for error recovery. gcc/testsuite/ 2009-12-11 Janus Weil <janus@gcc.gnu.org> PR fortran/42335 * gfortran.dg/select_type_11.f03: New test. From-SVN: r155162
2009-12-08re PR fortran/41177 (Wrong base-object checks for type-bound procedures)Daniel Kraft1-0/+1
2008-12-08 Daniel Kraft <d@domob.eu> PR fortran/41177 * gfortran.dg/typebound_proc_4.f03: Remove check for wrong error. * gfortran.dg/typebound_proc_13.f03: New test. 2008-12-08 Daniel Kraft <d@domob.eu> PR fortran/41177 * gfortran.h (struct symbol_attribute): New flag `class_pointer'. * symbol.c (gfc_build_class_symbol): Set the new flag. * resolve.c (update_compcall_arglist): Remove wrong check for non-scalar base-object. (check_typebound_baseobject): Add the correct version here as well as some 'not implemented' message check in the old case. (resolve_typebound_procedure): Check that the passed-object dummy argument is scalar, non-pointer and non-allocatable as it should be. From-SVN: r155086
2009-11-30backport: re PR fortran/42053 ([OOP] SELECT TYPE: reject duplicate CLASS IS ↵Janus Weil1-13/+219
blocks) merge from fortran-dev branch: gcc/fortran/ 2009-11-30 Janus Weil <janus@gcc.gnu.org> PR fortran/42053 * resolve.c (resolve_select_type): Check for duplicate CLASS IS blocks. 2009-11-30 Janus Weil <janus@gcc.gnu.org> PR fortran/41631 * decl.c (gfc_match_derived_decl): Set extension level. * gfortran.h (symbol_attribute): Expand 'extension' bit field to 8 bit. * iresolve.c (gfc_resolve_extends_type_of): Return value of 'is_extension_of' has kind=4. * match.c (select_type_set_tmp,gfc_match_class_is): Create temporary for CLASS IS blocks. * module.c (MOD_VERSION): Bump module version. (ab_attribute,attr_bits): Remove AB_EXTENSION. (mio_symbol_attribute): Handle expanded 'extension' field. * resolve.c (resolve_select_type): Implement CLASS IS blocks. (resolve_fl_variable_derived): Show correct type name. * symbol.c (gfc_build_class_symbol): Set extension level. 2009-11-30 Janus Weil <janus@gcc.gnu.org> * intrinsic.h (gfc_resolve_extends_type_of): Add prototype. * intrinsic.c (add_functions): Use 'gfc_resolve_extends_type_of'. * iresolve.c (gfc_resolve_extends_type_of): New function, which replaces the call to EXTENDS_TYPE_OF by the library function 'is_extension_of' and modifies the arguments. * trans-intrinsic.c (gfc_conv_extends_type_of): Removed. (gfc_conv_intrinsic_function): FOR EXTENDS_TYPE_OF, don't call gfc_conv_extends_type_of but gfc_conv_intrinsic_funcall. 2009-11-30 Paul Thomas <pault@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org> * decl.c (encapsulate_class_symbol): Replaced by 'gfc_build_class_symbol'. (build_sym,build_struct): Call 'gfc_build_class_symbol'. (gfc_match_derived_decl): Replace vindex by hash_value. * dump-parse-tree.c (show_symbol): Replace vindex by hash_value. * gfortran.h (symbol_attribute): Add field 'vtab'. (gfc_symbol): Replace vindex by hash_value. (gfc_class_esym_list): Ditto. (gfc_get_derived_type,gfc_build_class_symbol,gfc_find_derived_vtab): New prototypes. * module.c (mio_symbol): Replace vindex by hash_value. * resolve.c (vindex_expr): Rename to 'hash_value_expr'. (resolve_class_compcall,resolve_class_typebound_call): Renamed 'vindex_expr'. (resolve_select_type): Replace $vindex by $vptr->$hash. * symbol.c (gfc_add_save): Handle vtab symbols. (gfc_type_compatible): Rewrite. (gfc_build_class_symbol): New function which replaces 'encapsulate_class_symbol'. (gfc_find_derived_vtab): New function to set up a vtab symbol for a derived type. * trans-decl.c (gfc_create_module_variable): Handle vtab symbols. * trans-expr.c (select_class_proc): Replace vindex by hash_value. (gfc_conv_derived_to_class): New function to construct a temporary CLASS variable from a derived type expression. (gfc_conv_procedure_call): Call 'gfc_conv_derived_to_class'. (gfc_conv_structure): Initialize the $extends and $size fields of vtab symbols. (gfc_trans_class_assign): Replace $vindex by $vptr. Remove the $size assignment. * trans-intrinsic.c (gfc_conv_same_type_as): Replace $vindex by $vptr->$hash, and replace vindex by hash_value. * trans-stmt.c (gfc_trans_allocate): Insert $vptr references, replace $vindex by $vptr. Remove the $size assignment. * trans-types.c (gfc_get_derived_type): Make it non-static. gcc/testsuite/ 2009-11-30 Janus Weil <janus@gcc.gnu.org> PR fortran/42053 * gfortran.dg/select_type_9.f03: New. 2009-11-30 Janus Weil <janus@gcc.gnu.org> PR fortran/41631 * gfortran.dg/extends_type_of_1.f03: Fix invalid test case. * gfortran.dg/module_md5_1.f90: Adjusted MD5 sum. * gfortran.dg/select_type_1.f03: Remove FIXMEs. * gfortran.dg/select_type_2.f03: Ditto. * gfortran.dg/select_type_8.f03: New test. 2009-11-30 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/extends_type_of_1.f03: New test. * gfortran.dg/same_type_as_1.f03: Extended. 2009-11-30 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/class_4c.f03: Add dg-additional-sources. * gfortran.dg/class_4d.f03: Rename module. Cleanup modules. libgfortran/ 2009-11-30 Janus Weil <janus@gcc.gnu.org> * gfortran.map: Add _gfortran_is_extension_of. * Makefile.am: Add intrinsics/extends_type_of.c. * Makefile.in: Regenerated. * intrinsics/extends_type_of.c: New file. From-SVN: r154840
2009-10-22re PR fortran/41781 ([OOP] bogus undefined label error with SELECT TYPE.)Janus Weil1-2/+9
2009-10-22 Janus Weil <janus@gcc.gnu.org> PR fortran/41781 * resolve.c (resolve_codes): Don't clear 'cs_base' for BLOCK constructs, to make sure labels are treated correctly. * symbol.c (gfc_get_st_label): Create labels in the right namespace. For BLOCK constructs go into the parent namespace. 2009-10-22 Janus Weil <janus@gcc.gnu.org> PR fortran/41781 * gfortran.dg/goto_8.f90: New test case. From-SVN: r153446
2009-10-19re PR fortran/41755 (Segfault on invalid code)Tobias Burnus1-1/+1
2009-10-19 Tobias Burnus <burnus@net-b.de> Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/41755 * symbol.c (gfc_undo_symbols): Add NULL check. * match.c (gfc_match_equivalence): Add check for missing comma. 2009-10-19 Tobias Burnus <burnus@net-b.de> PR fortran/41755 * gfortran.dg/equiv_8.f90: New test. * gfortran.dg/class_allocate_1.f03: Remove obsolete FIXME. Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org> From-SVN: r152983
2009-10-09re PR fortran/41579 ([OOP] Nesting of SELECT TYPE)Janus Weil1-5/+14
2009-10-09 Janus Weil <janus@gcc.gnu.org> PR fortran/41579 * gfortran.h (gfc_select_type_stack): New struct, to be used as a stack for SELECT TYPE statements. (select_type_stack): New global variable. (type_selector,select_type_tmp): Removed. * match.c (type_selector,type_selector): Removed. (select_type_stack): New variable, serving as a stack for SELECT TYPE statements. (select_type_push,select_type_set_tmp): New functions. (gfc_match_select_type): Call select_type_push. (gfc_match_type_is): Call select_type_set_tmp. * parse.c (select_type_pop): New function. (parse_select_type_block): Call select_type_pop. * symbol.c (select_type_insert_tmp): New function. (gfc_find_sym_tree): Call select_type_insert_tmp. 2009-10-09 Janus Weil <janus@gcc.gnu.org> PR fortran/41579 * gfortran.dg/select_type_6.f03: New test. From-SVN: r152600
2009-10-07expr.c (gfc_check_pointer_assign): Do the correct type checking when CLASS ↵Janus Weil1-6/+6
variables are involved. 2009-10-07 Janus Weil <janus@gcc.gnu.org> * expr.c (gfc_check_pointer_assign): Do the correct type checking when CLASS variables are involved. * match.c (gfc_match_select_type): Parse associate-name in SELECT TYPE statements, and set up a local namespace for the SELECT TYPE block. * parse.h (gfc_build_block_ns): New prototype. * parse.c (parse_select_type_block): Return from local namespace to its parent after SELECT TYPE block. (gfc_build_block_ns): New function for setting up the local namespace for a BLOCK construct. (parse_block_construct): Use gfc_build_block_ns. * resolve.c (resolve_select_type): Insert assignment for the selector variable, in case an associate-name is given, and put the SELECT TYPE statement inside a BLOCK. (resolve_code): Call resolve_class_assign after checking the assignment. * symbol.c (gfc_find_sym_tree): Moved some code here from gfc_get_ha_sym_tree. (gfc_get_ha_sym_tree): Moved some code to gfc_find_sym_tree. 2009-10-07 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/same_type_as_2.f03: Modified (was illegal). * gfortran.dg/select_type_1.f03: Modified error message. * gfortran.dg/select_type_5.f03: New test. From-SVN: r152526
2009-10-05trans-expr.c (select_class_proc): New function.Paul Thomas1-1/+4
2009-10-05 Paul Thomas <pault@gcc.gnu.org> * trans-expr.c (select_class_proc): New function. (conv_function_val): Deal with class methods and call above. * symbol.c (gfc_type_compatible): Treat case where both ts1 and ts2 are BT_CLASS. gfortran.h : Add structure gfc_class_esym_list and include in the structure gfc_expr. * module.c (load_derived_extensions): New function. (read_module): Call above. (write_dt_extensions): New function. (write_derived_extensions): New function. (write_module): Use the above. * resolve.c (resolve_typebound_call): Add a function expression for class methods. This carries the chain of symbols for the dynamic dispatch in select_class_proc. (resolve_compcall): Add second, boolean argument to indicate if a function is being handled. (check_members): New function. (check_class_members): New function. (resolve_class_compcall): New function. (resolve_class_typebound_call): New function. (gfc_resolve_expr): Call above for component calls.. 2009-10-05 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/dynamic_dispatch_1.f90: New test. * gfortran.dg/dynamic_dispatch_2.f90: New test. * gfortran.dg/dynamic_dispatch_3.f90: New test. * gfortran.dg/module_md5_1.f90: Update md5 sum. From-SVN: r152463
2009-09-30re PR fortran/40996 ([F03] ALLOCATABLE scalars)Tobias Burnus1-11/+43
fortran/ 2009-09-30 Janus Weil <janus@gcc.gnu.org> * check.c (gfc_check_same_type_as): New function for checking SAME_TYPE_AS and EXTENDS_TYPE_OF. * decl.c (encapsulate_class_symbol): Set ABSTRACT attribute for class container, if the contained type has it. Add an initializer for the class container. (add_init_expr_to_sym): Handle BT_CLASS. (vindex_counter): New counter for setting vindices. (gfc_match_derived_decl): Set vindex for all derived types, not only those which are being extended. * expr.c (gfc_check_assign_symbol): Handle NULL initialization of class pointers. * gfortran.h (gfc_isym_id): New values GFC_ISYM_SAME_TYPE_AS and GFC_ISYM_EXTENDS_TYPE_OF. (gfc_type_is_extensible): New prototype. * intrinsic.h (gfc_check_same_type_as): New prototype. * intrinsic.c (add_functions): Add SAME_TYPE_AS and EXTENDS_TYPE_OF. * primary.c (gfc_expr_attr): Handle CLASS-valued functions. * resolve.c (resolve_structure_cons): Handle BT_CLASS. (type_is_extensible): Make non-static and rename to 'gfc_type_is_extensible. (resolve_select_type): Renamed type_is_extensible. (resolve_class_assign): Handle NULL pointers. (resolve_fl_variable_derived): Renamed type_is_extensible. (resolve_fl_derived): Ditto. * trans-expr.c (gfc_trans_subcomponent_assign): Handle NULL initialization of class pointer components. (gfc_conv_structure): Handle BT_CLASS. * trans-intrinsic.c (gfc_conv_same_type_as,gfc_conv_extends_type_of): New functions. (gfc_conv_intrinsic_function): Handle SAME_TYPE_AS and EXTENDS_TYPE_OF. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * gfortran.h (type_selector, select_type_tmp): New global variables. * match.c (type_selector, select_type_tmp): New global variables, used for SELECT TYPE statements. (gfc_match_select_type): Better error handling. Remember selector. (gfc_match_type_is): Create temporary variable. * module.c (ab_attribute): New value 'AB_IS_CLASS'. (attr_bits): New string. (mio_symbol_attribute): Handle 'is_class'. * resolve.c (resolve_select_type): Insert pointer assignment statement, to assign temporary to selector. * symbol.c (gfc_get_ha_sym_tree): Replace selector by a temporary in SELECT TYPE statements. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * dump-parse-tree.c (show_code_node): Renamed 'alloc_list'. * gfortran.h (gfc_code): Rename 'alloc_list'. Add member 'ts'. (gfc_expr_to_initialize): New prototype. * match.c (alloc_opt_list): Correctly check type compatibility. Renamed 'alloc_list'. (dealloc_opt_list): Renamed 'alloc_list'. * resolve.c (expr_to_initialize): Rename to 'gfc_expr_to_initialize' and make it non-static. (resolve_allocate_expr): Set vindex for CLASS variables correctly. Move initialization code to gfc_trans_allocate. Renamed 'alloc_list'. (resolve_allocate_deallocate): Renamed 'alloc_list'. (check_class_pointer_assign): Rename to 'resolve_class_assign'. Change argument type. Adjust to work with ordinary assignments. (resolve_code): Call 'resolve_class_assign' for ordinary assignments. Renamed 'check_class_pointer_assign'. * st.c (gfc_free_statement): Renamed 'alloc_list'. * trans-stmt.c (gfc_trans_allocate): Renamed 'alloc_list'. Handle size determination and initialization of CLASS variables. Bugfix for ALLOCATE statements with default initialization and SOURCE block. (gfc_trans_deallocate): Renamed 'alloc_list'. 2009-09-30 Paul Thomas <pault@gcc.gnu.org> * trans-expr.c (gfc_conv_procedure_call): Convert a derived type actual to a class object if the formal argument is a class. 2009-09-30 Janus Weil <janus@gcc.gnu.org> PR fortran/40996 * decl.c (build_struct): Handle allocatable scalar components. * expr.c (gfc_add_component_ref): Correctly set typespec of expression, after inserting component reference. * match.c (gfc_match_type_is,gfc_match_class_is): Make sure that no variables are being used uninitialized. * primary.c (gfc_match_varspec): Handle CLASS array components. * resolve.c (resolve_select_type): Transform EXEC_SELECT_TYPE to EXEC_SELECT. * trans-array.c (structure_alloc_comps,gfc_trans_deferred_array): Handle allocatable scalar components. * trans-expr.c (gfc_conv_component_ref): Ditto. * trans-types.c (gfc_get_derived_type): Ditto. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * decl.c (encapsulate_class_symbol): Modify names of class container components by prefixing with '$'. (gfc_match_end): Handle COMP_SELECT_TYPE. * expr.c (gfc_add_component_ref): Modify names of class container components by prefixing with '$'. * gfortran.h (gfc_statement): Add ST_SELECT_TYPE, ST_TYPE_IS and ST_CLASS_IS. (gfc_case): New field 'ts'. (gfc_exec_op): Add EXEC_SELECT_TYPE. (gfc_type_is_extension_of): New prototype. * match.h (gfc_match_select_type,gfc_match_type_is,gfc_match_class_is): New prototypes. * match.c (match_derived_type_spec): New function. (match_type_spec): Use 'match_derived_type_spec'. (match_case_eos): Modify error message. (gfc_match_select_type): New function. (gfc_match_case): Modify error message. (gfc_match_type_is): New function. (gfc_match_class_is): Ditto. * parse.h (gfc_compile_state): Add COMP_SELECT_TYPE. * parse.c (decode_statement): Handle SELECT TYPE, TYPE IS and CLASS IS statements. (next_statement): Handle ST_SELECT_TYPE. (gfc_ascii_statement): Handle ST_SELECT_TYPE, ST_TYPE_IS, ST_CLASS_IS. (parse_select_type_block): New function. (parse_executable): Handle ST_SELECT_TYPE. * resolve.c (resolve_deallocate_expr): Handle BT_CLASS. Modify names of class container components by prefixing with '$'. (resolve_allocate_expr): Ditto. (resolve_select_type): New function. (gfc_resolve_blocks): Handle EXEC_SELECT_TYPE. (check_class_pointer_assign): Modify names of class container components by prefixing with '$'. (resolve_code): Ditto. * st.c (gfc_free_statement): Ditto. * symbol.c (gfc_type_is_extension_of): New function. (gfc_type_compatible): Use 'gfc_type_is_extension_of', plus a bugfix. * trans.c (gfc_trans_code): Handel EXEC_SELECT_TYPE. 2009-09-30 Janus Weil <janus@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> * check.c (gfc_check_move_alloc): Arguments don't have to be arrays. The second argument needs to be type-compatible with the first (not the other way around, which makes a difference for CLASS entities). * decl.c (encapsulate_class_symbol): New function. (build_sym,build_struct): Handle BT_CLASS, call 'encapsulate_class_symbol'. (gfc_match_decl_type_spec): Remove warning, use BT_CLASS. (gfc_match_derived_decl): Set vindex; * expr.c (gfc_add_component_ref): New function. (gfc_copy_expr,gfc_check_pointer_assign,gfc_check_assign_symbol): Handle BT_CLASS. * dump-parse-tree.c (show_symbol): Print vindex. * gfortran.h (bt): New basic type BT_CLASS. (symbol_attribute): New field 'is_class'. (gfc_typespec): Remove field 'is_class'. (gfc_symbol): New field 'vindex'. (gfc_get_ultimate_derived_super_type): New prototype. (gfc_add_component_ref): Ditto. * interface.c (gfc_compare_derived_types): Pointer equality check moved here from gfc_compare_types. (gfc_compare_types): Handle BT_CLASS and use gfc_type_compatible. * match.c (gfc_match_allocate,gfc_match_deallocate,gfc_match_call): Handle BT_CLASS. * misc.c (gfc_clear_ts): Removed is_class. (gfc_basic_typename,gfc_typename): Handle BT_CLASS. * module.c (bt_types,mio_typespec): Handle BT_CLASS. (mio_symbol): Handle vindex. * primary.c (gfc_match_varspec,gfc_variable_attr): Handle BT_CLASS. * resolve.c (find_array_spec,check_typebound_baseobject): Handle BT_CLASS. (resolve_ppc_call,resolve_expr_ppc): Don't call 'gfc_is_proc_ptr_comp' inside 'gcc_assert'. (resolve_deallocate_expr,resolve_allocate_expr): Handle BT_CLASS. (check_class_pointer_assign): New function. (resolve_code): Handle BT_CLASS, call check_class_pointer_assign. (resolve_fl_var_and_proc,type_is_extensible,resolve_fl_variable_derived, resolve_fl_variable): Handle BT_CLASS. (check_generic_tbp_ambiguity): Add special case. (resolve_typebound_procedure,resolve_fl_derived): Handle BT_CLASS. * symbol.c (gfc_get_ultimate_derived_super_type): New function. (gfc_type_compatible): Handle BT_CLASS. * trans-expr.c (conv_parent_component_references): Handle CLASS containers. (gfc_conv_initializer): Handle BT_CLASS. * trans-types.c (gfc_typenode_for_spec,gfc_get_derived_type): Handle BT_CLASS. testsuite/ 2009-09-30 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/same_type_as_1.f03: New test. * gfortran.dg/same_type_as_2.f03: Ditto. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/select_type_1.f03: Extended. * gfortran.dg/select_type_3.f03: New test. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/class_allocate_1.f03: New test. 2009-09-30 Janus Weil <janus@gcc.gnu.org> PR fortran/40996 * gfortran.dg/allocatable_scalar_3.f90: New test. * gfortran.dg/select_type_2.f03: Ditto. * gfortran.dg/typebound_proc_5.f03: Changed error messages. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/block_name_2.f90: Modified error message. * gfortran.dg/select_6.f90: Ditto. * gfortran.dg/select_type_1.f03: New test. 2009-09-30 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/allocate_derived_1.f90: Remove -w option. * gfortran.dg/class_1.f03: Ditto. * gfortran.dg/class_2.f03: Ditto. * gfortran.dg/proc_ptr_comp_pass_1.f90: Ditto. * gfortran.dg/proc_ptr_comp_pass_2.f90: Ditto. * gfortran.dg/proc_ptr_comp_pass_3.f90: Ditto. * gfortran.dg/typebound_call_10.f03: Ditto. * gfortran.dg/typebound_call_2.f03: Ditto. * gfortran.dg/typebound_call_3.f03: Ditto. * gfortran.dg/typebound_call_4.f03: Ditto. * gfortran.dg/typebound_call_9.f03: Ditto. * gfortran.dg/typebound_generic_3.f03: Ditto. * gfortran.dg/typebound_generic_4.f03: Ditto. * gfortran.dg/typebound_operator_1.f03: Ditto. * gfortran.dg/typebound_operator_2.f03: Ditto. * gfortran.dg/typebound_operator_3.f03: Ditto. * gfortran.dg/typebound_operator_4.f03: Ditto. * gfortran.dg/typebound_proc_1.f08: Ditto. * gfortran.dg/typebound_proc_5.f03: Ditto. * gfortran.dg/typebound_proc_6.f03: Ditto. From-SVN: r152345