diff options
Diffstat (limited to 'gcc/fortran')
49 files changed, 3920 insertions, 3104 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 5045220f038..8c2cb3cc4b1 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,2797 +1,102 @@ -2012-12-28 Janus Weil <janus@gcc.gnu.org> - - PR fortran/55692 - * check.c (gfc_check_associated): Remove a "gcc_assert (0)". - -2012-12-28 Tobias Burnus <burnus@net-b.de> - - PR fortran/55763 - * check.c (gfc_check_move_alloc): Handle unlimited polymorphic. - * trans-intrinsic.c (conv_intrinsic_move_alloc): Ditto. +2013-01-06 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/PR53876 + PR fortran/PR54990 + PR fortran/PR54992 + * trans-array.c (build_array_ref): Check the TYPE_CANONICAL + to see if it is GFC_CLASS_TYPE_P. + * trans-expr.c (gfc_get_vptr_from_expr): The same. + (gfc_conv_class_to_class): If the types are not the same, + cast parmese->expr to the type of ctree. + * trans-types.c (gfc_get_derived_type): GFC_CLASS_TYPE_P of + CLASS components must be set. + +2013-01-06 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/42769 + PR fortran/45836 + PR fortran/45900 + * module.c (read_module): Don't reuse local symtree if the associated + symbol isn't exactly the one wanted. Don't reuse local symtree if it is + ambiguous. + * resolve.c (resolve_call): Use symtree's name instead of symbol's to + lookup the symtree. + +2013-01-05 Steven G. Kargl <kargl@gcc.gnu.org> + Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/55827 + * class.c (gfc_fix_class_refs): Adapt ts initialization for the case + e->symtree == NULL. + * trans-expr.c (gfc_conv_function_expr): Init sym earlier. Use it. + +2013-01-05 Tobias Burnus <burnus@net-b.de> + + * class.c (finalize_component): Used passed offset expr. + (finalization_get_offset): New static function. + (finalizer_insert_packed_call, generate_finalization_wrapper): Use it + to handle noncontiguous arrays. + +2013-01-04 Tobias Burnus <burnus@net-b.de> + + * trans.c (gfc_build_final_call): New function. + * trans.h (gfc_build_final_call, gfc_conv_scalar_to_descriptor): + New function prototypes. + * trans-expr.c (gfc_conv_scalar_to_descriptor): Renamed from + conv_scalar_to_descriptor, removed static attribute. + (gfc_conv_procedure_call): Honor renaming. + +2013-01-04 Tobias Burnus <burnus@net-b.de> + + * intrinsic.c (add_functions): New internal intrinsic + function GFC_PREFIX ("stride"). + * gfortran.h (gfc_isym_id): Add GFC_ISYM_STRIDE. + * intrinsic.h (gfc_resolve_stride): New prototypes. + * iresolve.c (gfc_resolve_stride): New function. + * trans-intrinsic.c (conv_intrinsic_stride): New static + function. + (gfc_conv_intrinsic_function): Use it. -2012-12-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> +2013-01-04 Tobias Burnus <burnus@net-b.de> - PR fortran/48976 - * gfortran.h (gfc_inquire struct): Add pointer for inquire stream. - * io.c (io_tag): Add tag for inquire stream. (match_inquire_element): - Add matcher for new tag. (gfc_resolve_inquire): Resolve new tag. - * ioparm.def: Add new parameter for inquire stream. - * trans-io.c (gfc_trans_inquire): Add tranlste code for inquire - stream. + * class.c (gfc_find_intrinsic_vtab): Add _final + component. + * decl.c (gfc_match_null): Remove superfluous + variadic argument to gfc_match. -2012-12-23 Tobias Burnus <burnus@net-b.de> +2013-01-04 Paul Thomas <pault@gcc.gnu.org> - PR fortran/54884 - * module.c (write_symbol1_recursion): Set attr.public_use. - * interface.c (check_sym_interfaces, check_uop_interfaces, - gfc_check_interfaces): Remove attr.public_use code. - * resolve.c (resolve_function, resolve_variable, - resolve_typebound_procedure): Ditto. + PR fortran/55172 + * match.c (copy_ts_from_selector_to_associate): Remove call to + gfc_resolve_expr and replace it with explicit setting of the + array reference type. + * resolve.c (resolve_select_type): It is an error if the + selector is coindexed. -2012-12-22 Tobias Burnus <burnus@net-b.de> +2013-01-04 Tobias Burnus <burnus@net-b.de> PR fortran/55763 - * module.c (mio_component): Don't skip _hash's initializer. - * resolve.c (resolve_select_type): Add an assert. - * trans-expr.c (gfc_conv_procedure_call): Handle - INTENT(OUT) for UNLIMIT_POLY. + * decl.c (gfc_match_null): Parse and reject MOLD. -2012-12-21 Richard Biener <rguenther@suse.de> - - PR bootstrap/54659 - * gfortran.h: Do not include gmp.h here. - -2012-12-21 Paul Thomas <pault@gcc.gnu.org> +2013-01-04 Tobias Burnus <burnus@net-b.de> + PR fortran/55854 PR fortran/55763 - * match.c (select_type_set_tmp): Return is a derived type or - class typespec has no derived type. - * resolve.c (resolve_fl_var_and_proc): Exclude select type - temporaries from 'pointer'. - (resolve_symbol): Exclude select type temporaries from tests - for assumed size and assumed rank. - -2012-12-20 Janus Weil <janus@gcc.gnu.org> - - PR fortran/36044 - * gfortran.h (gfc_isym_id): Add GFC_ISYM_BACKTRACE. - * intrinsic.c (add_subroutines): Add "backtrace". - * intrinsic.texi (BACKTRACE): Document BACKTRACE intrinsic. - -2012-12-20 Tobias Burnus <burnus@net-b.de> - - PR fortran/54818 - * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ensure that - the string length is of type gfc_charlen_type_node. - -2012-12-19 Paul Thomas <pault@gcc.gnu.org> - - * array.c (resolve_array_list): Apply C4106. - * check.c (gfc_check_same_type_as): Exclude polymorphic - entities from check for extensible types. Improved error - for disallowed argument types to name the offending type. - * class.c : Update copyright date. - (gfc_class_null_initializer): Add argument for initialization - expression and deal with unlimited polymorphic typespecs. - (get_unique_type_string): Give unlimited polymorphic - entities a type string. - (gfc_intrinsic_hash_value): New function. - (gfc_build_class_symbol): Incorporate unlimited polymorphic - entities. - (gfc_find_derived_vtab): Deal with unlimited polymorphic - entities. - (gfc_find_intrinsic_vtab): New function. - * decl.c (gfc_match_decl_type_spec): Match typespec for - unlimited polymorphic type. - (gfc_match_data_decl): Skip to 'ok' if unlimited polymorphic. - expr.c (gfc_check_pointer_assign): Apply C717. If unlimited - polymorphic lvalue, find rvalue vtable for all typespecs, - except unlimited polymorphic expressions. - (gfc_check_vardef_context): Handle unlimited polymorphic - entities. - * gfortran.h : Add unlimited polymorphic attribute. Add - second arg to gfc_class_null_initializer primitive and - primitive for gfc_find_intrinsic_vtab. Add UNLIMITED_POLY - to detect unlimited polymorphic expressions. - * interface.c (gfc_compare_types): If expr1 is unlimited - polymorphic, always return 1. If expr2 is unlimited polymorphic - enforce C717. - (gfc_compare_interfaces): Skip past conditions that do not - apply for unlimited polymorphic entities. - (compare_parameter): Make sure that an unlimited polymorphic, - allocatable or pointer, formal argument is matched by an - unlimited polymorphic actual argument. - (compare_actual_formal): Ensure that an intrinsic vtable exists - to match an unlimited polymorphic formal argument. - * match.c (gfc_match_allocate): Type kind parameter does not - need to match an unlimited polymorphic allocate-object. - (alloc_opt_list): An unlimited polymorphic allocate-object - requires a typespec or a SOURCE tag. - (select_intrinsic_set_tmp): New function. - (select_type_set_tmp): Call new function. If it returns NULL, - build a derived type or class temporary instead. - (gfc_match_type_is): Remove restriction to derived types only. - Bind(C) or sequence derived types not permitted. - * misc (gfc_typename): Printed CLASS(*) for unlimited - polymorphism. - * module.c : Add AB_UNLIMITED_POLY to pass unlimited - polymorphic attribute to and from modules. - * resolve.c (resolve_common_vars): Unlimited polymorphic - entities cannot appear in common blocks. - (resolve_deallocate_expr): Deallocate unlimited polymorphic - enities. - (resolve_allocate_expr): Likewise for allocation. Make sure - vtable exists. - (gfc_type_is_extensible): Unlimited polymorphic entities are - not extensible. - (resolve_select_type): Handle unlimited polymorphic selectors. - Ensure that length type parameters are assumed and that names - for intrinsic types are generated. - (resolve_fl_var_and_proc): Exclude select type temporaries - from test of extensibility of type. - (resolve_fl_variable): Likewise for test that assumed character - length must be a dummy or a parameter. - (resolve_fl_derived0): Return SUCCESS unconditionally for - unlimited polymorphic entities. Also, allow unlimited - polymorphic components. - (resolve_fl_derived): Return SUCCESS unconditionally for - unlimited polymorphic entities. - (resolve_symbol): Return early with unlimited polymorphic - entities. - * simplifiy.c : Update copyright year. - (gfc_simplify_extends_type_of): No simplification possible - for unlimited polymorphic arguments. - * symbol.c (gfc_use_derived): Nothing to do for unlimited - polymorphic "derived type". - (gfc_type_compatible): Return unity if ts1 is unlimited - polymorphic. - * trans-decl.c (create_function_arglist) Formal arguments - without a character length should be treated in the same way - as passed lengths. - (gfc_trans_deferred_vars): Nullify the vptr of unlimited - polymorphic pointers. Avoid unlimited polymorphic entities - triggering gcc_unreachable. - * trans-expr.c (gfc_conv_intrinsic_to_class): New function. - (gfc_trans_class_init_assign): Make indirect reference of - src.expr. - (gfc_trans_class_assign): Expression NULL of unknown type - should set NULL vptr on lhs. Treat C717 cases where lhs is - a derived type and the rhs is unlimited polymorphic. - (gfc_conv_procedure_call): Handle the conversion of a non-class - actual argument to match an unlimited polymorphic formal - argument. Suppress the passing of a character string length - in this case. Make sure that calls to the character __copy - function have two character string length arguments. - (gfc_conv_initializer): Pass the initialization expression to - gfc_class_null_initializer. - (gfc_trans_subcomponent_assign): Ditto. - (gfc_conv_structure): Move handling of _size component. - trans-intrinsic.c: (gfc_conv_same_type_as): Handle conditions - where unlimited polymorphic arguments have null vptr. - * trans-stmt.c (trans_associate_var): Correctly treat array - temporaries associated with unlimited polymorphic selectors. - Recover the overwritten dtype for the descriptor. Use the _size - field of the vptr for character string lengths. - (gfc_trans_allocate): Cope with unlimited polymorphic allocate - objects; especially with character source tags. - (reset_vptr): New function. - (gfc_trans_deallocate): Call it. - * trans-types.c (gfc_get_derived_type): Detect unlimited - polymorphic types and deal with cases where the derived type of - components is null. - * trans.c : Update copyright year. - (trans_code): Call gfc_trans_class_assign for C717 cases where - the lhs is not unlimited polymorphic. - -2012-12-19 Tobias Burnus <burnus@net-b.de> - - PR fortran/55733 - * trans-decl.c (gfc_create_string_length): Avoid setting - TREE_STATIC for automatic variables with -fno-automatic. - -2012-12-19 Tobias Burnus <burnus@net-b.de> - Jakub Jelinek <jakub@redhat.com> - Janus Weil <janus@gcc.gnu.org> - - PR fortran/55636 - PR fortran/55733 - * gfortran.h (GFC_PREFIX): Define. - * trans-decl.c (gfc_create_string_length): For VAR_DECLs that - will be TREE_STATIC, use GFC_PREFIX to mangle the names. Handle - -fno-automatic - (gfc_trans_deferred_vars): Don't free variables SAVEd via - -fno-automatic. - -2012-12-16 Tobias Burnus <burnus@net-b.de> - - PR fortran/55197 - * module.c (gfc_use_module): Free rename list only for - internally generated intrinsic modules. - -2012-12-16 Tobias Burnus <burnus@net-b.de> - - * trans-intrinsic.c (conv_intrinsic_move_alloc): Set dynamic - type of the FROM variable to the declared type. - -2012-12-16 Tobias Burnus <burnus@net-b.de> - - PR fortran/55638 - * resolve.c (resolve_formal_arglist): Allow VALUE without - INTENT for ELEMENTAL procedures. - -2012-12-10 Janus Weil <janus@gcc.gnu.org> - - PR fortran/52909 - * trans-decl.c (get_proc_pointer_decl): Apply name mangling. - -2012-12-09 Tobias Burnus <burnus@net-b.de> - - * trans-array.c (structure_alloc_comps): Use NULL_TREE in the - call to gfc_deallocate_scalar_with_status. - * trans-decl.c (gfc_trans_deferred_vars): Pass symbol. - * trans-stmt.c (gfc_trans_deallocate): Pass polymorphic variable. - -2012-12-09 Thomas Koenig <tkoenig@gcc.gnu.org> - - PR fortran/55593 - * frontend-passes.c (doloop_code): Use resolved_sym - instead of n.sym->formal for formal argument list - to get the correct version for all generic subroutines. - -2012-12-05 Tobias Burnus <burnus@net-b.de> - - * resolve.c (generate_component_assignments): Fix memleak. - -2012-12-03 Janus Weil <janus@gcc.gnu.org> - - PR fortran/55548 - * intrinsic.texi (SYSTEM_CLOCK): Update documentation of SYSTEM_CLOCK. - -2012-12-03 Tobias Burnus <burnus@net-b.de> - Janus Weil <janus@gcc.gnu.org> - - PR fortran/37336 - * class.c (gfc_is_finalizable): New function. - * gfortran.h (gfc_is_finalizable): Its prototype. - * module.c (mio_component): Read initializer for vtype's _final. - * resolve.c (resolve_fl_derived0): Call gfc_is_finalizable. - * trans-expr.c (gfc_vtable_final_get): New function. - (conv_parent_component_references): Fix comment. - (gfc_conv_variable): Fix for scalar coarray components. - * trans-intrinsic.c (conv_intrinsic_move_alloc): For BT_CLASS, - pass the BT_CLASS type and not the declared type to - gfc_deallocate_scalar_with_status. - * trans.h (gfc_vtable_final_get): New prototype. - -2012-12-03 Tobias Burnus <burnus@net-b.de> - - PR fortran/55475 - * scanner.c (gfc_next_char_literal): Fix setting locus - to free_line_length for the error message. - * error.c (show_locus): Fix potential out-of-bounds - read. - -2012-12-03 Tobias Burnus <burnus@net-b.de> - - PR fortran/37336 - * class.c (finalizer_insert_packed_call): New static function. - (finalize_component, generate_finalization_wrapper): - Fix coarray handling and packing. - -2012-12-02 Paul Thomas <pault@gcc.gnu.org> - - * resolve.c (resolve_allocate_deallocate, - resolve_typebound_intrinsic_op): Recover revisions 193568 and - 193778, which were accidentally reverted by the previous patch. - -2012-12-01 Alessandro Fanfarillo <alessandro.fanfarillo@gmail.com> - Paul Thomas <pault@gcc.gnu.org> - - PR fortran/46897 - * gfortran.h : Add bit field 'defined_assign_comp' to - symbol_attribute structure. - Add primitive for gfc_add_full_array_ref. - * expr.c (gfc_add_full_array_ref): New function. - (gfc_lval_expr_from_sym): Call new function. - * resolve.c (add_comp_ref): New function. - (build_assignment): New function. - (get_temp_from_expr): New function - (add_code_to_chain): New function - (generate_component_assignments): New function that calls all - the above new functions. - (resolve_code): Call generate_component_assignments. - (check_defined_assignments): New function. - (resolve_fl_derived0): Call check_defined_assignments. - (gfc_resolve): Reset component_assignment_level in case it is - left in a bad state by errors. - - - * resolve.c (is_sym_host_assoc, resolve_procedure_interface, - resolve_contained_fntype, resolve_procedure_expression, - resolve_elemental_actual, resolve_global_procedure, - is_scalar_expr_ptr, gfc_iso_c_func_interface, resolve_function, - set_name_and_label, gfc_iso_c_sub_interface, - resolve_specific_s0, resolve_operator, compare_bound_mpz_t, - gfc_resolve_character_operator, resolve_typebound_function, - gfc_resolve_expr, forall_index, remove_last_array_ref, - conformable_arrays, resolve_allocate_expr, - resolve_allocate_deallocate, resolve_select_type, - resolve_transfer, resolve_where, - gfc_resolve_where_code_in_forall, gfc_resolve_forall_body, - gfc_count_forall_iterators, resolve_values, - resolve_bind_c_comms, resolve_bind_c_derived_types, - gfc_verify_binding_labels, apply_default_init, - build_default_init_expr, apply_default_init_local, - resolve_fl_var_and_proc, resolve_fl_procedure, - gfc_resolve_finalizers, check_generic_tbp_ambiguity, - resolve_typebound_intrinsic_op, resolve_typebound_procedure, - resolve_typebound_procedures, ensure_not_abstract, - resolve_fl_derived0, resolve_fl_parameter, resolve_symbol, - resolve_equivalence_derived): Remove trailing white space. - * gfortran.h : Remove trailing white space. - -2012-11-28 Tobias Burnus <burnus@net-b.de> - - PR fortran/52161 - * trans-stmt.c (gfc_trans_sync): Fix bound checking - for -fcoarray=lib. - -2012-11-28 Tobias Burnus <burnus@net-b.de> - - PR fortran/52161 - * trans-stmt.c (gfc_trans_sync): Fix bound checking. - -2012-11-27 Tobias Burnus <burnus@net-b.de> - - PR fortran/55476 - * expr.c (gfc_check_pointer_assign): Fix check - pointer-might-outlive-target check for host_assoc. - -2012-11-26 Eric Botcazou <ebotcazou@adacore.com> - - * trans-decl.c (gfc_finish_var_decl): Do not set DECL_RESTRICTED_P. - -2012-11-26 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54997 - * decl.c (match_procedure_decl): Don't set 'referenced' attribute - for PROCEDURE declarations. - * parse.c (gfc_fixup_sibling_symbols,parse_contained): Don't set - 'referenced' attribute for all contained procedures. - * trans-decl.c (gfc_get_symbol_decl): Allow for unreferenced procedures. - (build_function_decl): Set TREE_USED for referenced procedures. - -2012-11-26 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54881 - * match.c (select_derived_set_tmp,select_class_set_tmp): Removed and - unified into ... - (select_type_set_tmp): ... this one. Set POINTER argument according to - selector. - * trans-intrinsic.c (gfc_conv_associated): Use 'gfc_class_data_get' - instead of 'gfc_add_data_component'. - -2012-11-25 Thomas Koenig <tkoenig@gcc.gnu.org> - - PR fortran/30146 - * frontend-passes.c (doloop_warn): New function. - (doloop_list): New static variable. - (doloop_size): New static variable. - (doloop_level): New static variable. - (gfc_run_passes): Call doloop_warn. - (doloop_code): New function. - (doloop_function): New function. - (gfc_code_walker): Keep track of DO level. - -2012-11-24 Thomas Koenig <tkoenig@gcc.gnu.org> - - PR fortran/55314 - * resolve.c (resolve_allocate_deallocate): Compare all - subscripts when deciding if to reject a (de)allocate - statement. - -2012-11-21 Janus Weil <janus@gcc.gnu.org> - - PR fortran/55352 - * trans-decl.c (generate_local_decl): Don't warn for explicitly imported - but unused module variables which are in a namelist or common block. - -2012-11-20 Diego Novillo <dnovillo@google.com> - Jakub Jelinek <jakub@redhat.com> - - * trans-openmp.c: Replace all vec<T, A>() initializers - with vNULL. - -2012-11-17 Diego Novillo <dnovillo@google.com> - - Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) - - * frontend-passes.c: Use new vec API in vec.h. - * trans-array.c: Likewise. - * trans-common.c: Likewise. - * trans-decl.c: Likewise. - * trans-expr.c: Likewise. - * trans-intrinsic.c: Likewise. - * trans-openmp.c: Likewise. - * trans-stmt.c: Likewise. - * trans-types.c: Likewise. - * trans.h: Likewise. - -2012-11-17 Jakub Jelinek <jakub@redhat.com> - - PR fortran/55341 - * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Convert last - argument to memcpy to size_type_node type. - * trans-stmt.c (gfc_conv_elemental_dependencies): Likewise. - * trasn-array.c (duplicate_allocatable): Likewise. - -2012-11-16 Janus Weil <janus@gcc.gnu.org> - - PR fortran/55297 - * resolve.c (resolve_typebound_intrinsic_op): Only add typebound - operators to the operator list in the namespace of the derived type. - - -2012-11-12 Jan Hubicka <jh@suse.cz> - - * f95-lang.c (ATTR_NOTHROW_LEAF_MALLOC_LIST): New macro. - (gfc_define_builtin): Use set_call_expr_flags. - (gfc_init_builtin_functions): Update. - -2012-11-12 Tobias Burnus <burnus@net-b.de> - - PR fortran/55272 - * module.c (mio_array_spec): Correctly handle coarray - scalars. - -2012-11-07 Tobias Schlüter <tobi@gcc.gnu.org> - - PR fortran/51727 - * module.c (sorted_pointer_info): New. - (gfc_get_sorted_pointer_info): New. - (free_sorted_pointer_info_tree): New. - (compare_sorted_pointer_info): New. - (find_symbols_to_write): New. - (write_symbol1_recursion): New. - (write_symbol1): Collect symbols that need writing, output in order. - (write_generic): Traverse tree in order. - -2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org> - - PR c/53063 - * options.c (set_Wall): Do not set warn_switch here. - -2012-11-06 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54917 - * target-memory.c (gfc_target_expr_size,gfc_target_interpret_expr): - Handle BT_CLASS. - * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Add support for - polymorphic arguments. - -2012-11-04 Janus Weil <janus@gcc.gnu.org> - - PR fortran/55199 - * primary.c (gfc_match_varspec): Clear typespec if it cannot be - determined at this point. - -2012-10-31 Janus Weil <janus@gcc.gnu.org> - - PR fortran/53718 - * trans.h (GFC_DECL_PUSH_TOPLEVEL): Removed. - * trans-decl.c (gfc_get_symbol_decl,gfc_generate_function_code): Remove - GFC_DECL_PUSH_TOPLEVEL. - (build_function_decl): Do not push __copy procedure to toplevel. - -2012-10-31 Tobias Burnus <burnus@net-b.de> - - PR fortran/55134 - * trans-array.c (gfc_conv_array_parameter): Regard AS_DEFERRED as - array with descriptor. - -2012-10-28 Tobias Burnus <burnus@net-b.de> - - PR fortran/54958 - * gfortran.h (gfc_resolve_iterator_expr, - gfc_check_vardef_context): Update prototype. - * expr.c (gfc_check_vardef_context): Add own_scope - argument and honour it. - * resolve.c (gfc_resolve_iterator_expr): Add own_scope - argument and honour it. - (resolve_deallocate_expr, resolve_allocate_expr, - resolve_data_variables, resolve_transfer - resolve_lock_unlock, resolve_code): Update calls. - * array.c (resolve_array_list): Ditto. - * check.c (gfc_check_atomic_def, gfc_check_atomic_ref): Ditto. - * interface.c (compare_actual_formal): Ditto. - * intrinsic.c (check_arglist): Ditto. - * io.c (resolve_tag, gfc_resolve_dt, gfc_resolve_inquire): Ditto. - -2012-10-27 Thomas Koenig <tkoenig@gcc.gnu.org> - - * trans.c (gfc_allocate_allocatable): Revert accidental - commit. - -2012-10-24 Janus Weil <janus@gcc.gnu.org> - - PR fortran/55037 - * trans-expr.c (gfc_conv_procedure_call): Move a piece of code and - remove an assert. - -2012-10-21 Tobias Burnus <burnus@net-b.de> - - PR fortran/54725 - * Make-lang.in (CFLAGS-cpp.o): Use TARGET_SYSTEM_ROOT_DEFINE. - * cpp.o (gfc_cpp_init_options): Use it for - setting gfc_cpp_option.sysroot. - -2012-10-21 Thomas König <tkoenig@gcc.gnu.org> - - PR fortran/54465 - * lang.opt (Wextra): Add. - * invoke.texi: Document that -Wc-binding-type, -Wconversion - and -Wline-truncation are implied by -Wall. Document that - -Wcompare-reals is implied by -Wextra. Document -Wextra. - * options.c (set_Wextra): New function. - (gfc_handle_option): Handle -Wextra. - -2012-10-19 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54224 - * trans-expr.c (conv_function_val): Set TREE_USED. - -2012-10-18 Tobias Burnus <burnus@net-b.de> - - PR fortran/54884 - * resolve.c (specification_expr): Change to bool. - (resolve_formal_arglist, resolve_symbol): Set - specification_expr to true before resolving the array spec. - (resolve_variable, resolve_charlen, resolve_fl_variable): - Properly reset specification_expr. - (resolve_function): Set public_use when used in - a specification expr. - -2012-10-16 Tobias Burnus <burnus@net-b.de> - - PR fortran/50981 - PR fortran/54618 - * trans.h (gfc_conv_derived_to_class, gfc_conv_class_to_class): - Update prototype. - * trans-stmt.c (trans_associate_var,gfc_trans_allocate): Update - calls to those functions. - * trans-expr.c (gfc_conv_derived_to_class, gfc_conv_class_to_class, - gfc_conv_expr_present): Handle absent polymorphic arguments. - (class_scalar_coarray_to_class): New function. - (gfc_conv_procedure_call): Update calls. - -2012-10-12 Janus Weil <janus@gcc.gnu.org> - - PR fortran/40453 - * interface.c (check_dummy_characteristics): Recursively check dummy - procedures. - -2012-10-11 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54784 - * trans-stmt.c (gfc_trans_allocate): Correctly determine the reference - to the _data component for polymorphic allocation with SOURCE. - -2012-10-06 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54832 - * resolve.c (resolve_fl_derived0): Correctly copy the 'class_ok' - attribute for proc-ptr components with RESULT variable. - -2012-10-06 Janus Weil <janus@gcc.gnu.org> - - PR fortran/45521 - * interface.c (generic_correspondence): Implement additional - distinguishability criteria of F08. - (compare_actual_formal): Reject data object as actual argument for - procedure formal argument. - -2012-10-04 Tobias Burnus <burnus@net-b.de> - - * expr.c (scalarize_intrinsic_call): Plug memory leak. - * frontend-passes.c (gcc_assert): Extend assert. - * interface.c (gfc_compare_derived_types): Fix comparison. - (gfc_check_operator_interface): Move up to make this error - message reachable. - (get_sym_storage_size): Remove always-true checks. - * io.c (format_lex): Add comment. - (gfc_free_wait): Free memory. - * match.c (gfc_match_select_type): Ditto. - * matchexpr.c (match_level_3): Ditto. - * primary.c (match_string_constant): Ditto. - (match_actual_arg): Check return value. - * resolve.c (gfc_resolve_substring_charlen, - resolve_typebound_generic_call, resolve_typebound_function, - resolve_typebound_subroutine): Free memory. - * trans-types.c (gfc_get_derived_type): Remove always-true check. - -2012-10-02 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54778 - * interface.c (matching_typebound_op): Check for 'class_ok' attribute. - -2012-09-30 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54667 - * intrinsic.texi (C_F_POINTER): Fix description. - * resolve.c (gfc_iso_c_sub_interface): Add a check for FPTR argument - of C_F_POINTER. Modify two error messages. Cleanup. - -2012-09-24 Tobias Burnus <burnus@net-b.de> - - PR fortran/54618 - PR fortran/54690 - * trans-expr.c (gfc_conv_procedure_call): Fix INTENT(OUT) - handling for allocatable BT_CLASS. - -2012-09-24 Lawrence Crowl <crowl@google.com> - - * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. - * target-memory.c (gfc_interpret_logical): Likewise. - -2012-09-23 Tobias Burnus <burnus@net-b.de> - - * parse.c (parse_derived): Don't set attr.alloc_comp - for pointer components with allocatable subcomps. - - PR fortran/54599 - * resolve.c (resolve_fl_namelist): Remove superfluous - NULL check. - * simplify.c (simplify_min_max): Remove unreachable code. - * trans-array.c (gfc_trans_create_temp_array): Change - a condition into an assert. - - PR fortran/54618 - * trans-expr.c (gfc_trans_class_init_assign): Guard - re-setting of the _data by gfc_conv_expr_present. - (gfc_conv_procedure_call): Fix INTENT(OUT) handling - for allocatable BT_CLASS. - -2012-09-22 Thomas König <tkoenig@gcc.gnu.org> - - PR fortran/54599 - * dependency.c (gfc_dep_compare_expr): Clarify logic, - remove dead code. - -2012-09-20 Tobias Burnus <burnus@net-b.de> - - PR fortran/54599 - * cpp.c (print_line): Properly handle extern C. - -2012-09-20 Martin Jambor <mjambor@suse.cz> - - * trans-decl.c (gfc_get_extern_function_decl): Push NULL cfun. Do not - set and restore current_function_decl. - (gfc_init_coarray_decl): Do not set and restore current_function_decl. - -2012-09-17 Tobias Burnus <burnus@net-b.de> - - PR fortran/54608 - * simplify.c (gfc_simplify_scan, gfc_simplify_verify): - Fix handling of BACK=variable. - -2012-09-17 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54285 - * expr.c (gfc_check_pointer_assign): Correctly handle procedure pointers - as function results. - * primary.c (gfc_match_varspec): Allow to call a PPC with proc-ptr - result. - -2012-09-17 Tobias Burnus <burnus@net-b.de> - - PR fortran/54603 - * trans-expr.c (gfc_trans_subcomponent_assign): Handle - proc-pointer components. - -2012-09-17 Tobias Burnus <burnus@net-b.de> - - PR fortran/54599 - * error.c (error_print): Move increment out of the assert. - * interface.c (gfc_compare_derived_types): Add assert. - (get_expr_storage_size): Remove always-true logical condition. - * resolve.c (resolve_allocate_expr): Fix looping logic. - * target-memory.c (gfc_target_expr_size): Add assert. - -2012-09-16 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54594 - * resolve.c (get_checked_tb_operator_target): Add a reference to the - relevant quote from the F08 standard. - -2012-09-16 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54594 - * interface.c (compare_type_rank): Handle CLASS arrays. - -2012-09-16 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54387 - * expr.c (gfc_check_pointer_assign): Check for result of embracing - function. - -2012-09-16 Tobias Burnus <burnus@net-b.de> - - * trans-decl.c (gfc_generate_function_code): Fix - gfc_option.coarray check. - * trans-stmt.c (compute_inner_temp_size): Fix handling - of gfc_option.rtcheck. - -2012-09-16 Mikael Morin <mikael@gcc.gnu.org> - - * symbol.c (gfc_undo_symbols): Correctly undo namelists. - -2012-09-15 Tobias Burnus <burnus@net-b.de> - - * trans-io.c (gfc_trans_transfer): Add an assert. - -2012-09-15 Tobias Burnus <burnus@net-b.de> - - * arith.c (arith_power): Call gfc_free_expr in case of error. - * array.c (gfc_match_array_constructor): Initialize variable. - (gfc_resolve_character_array_constructor): Remove superfluous check. - (gfc_array_dimen_size): Add assert. - * check.c (numeric_check): Fix implicit typing. - * class.c (gfc_build_class_symbol): Add assert. - (finalize_component): Free memory. - * dump-parse-tree.c (show_namespace): Add assert. - * trans-io.c (transfer_namelist_element, transfer_expr): Avoid - memory leakage. - (gfc_trans_transfer): Add assert. - * trans.c (gfc_trans_runtime_check): Call va_end - -2012-09-15 Tobias Burnus <burnus@net-b.de> - - * match.c (lock_unlock_statement, sync_statement): Fix potential - double freeing. - (sync_statement): Remove unreachable code. - * simplify.c (gfc_simplify_bessel_n2): Avoid double freeing. - (gfc_simplify_repeat): Remove bogus code. - * target-memory.h (gfc_target_encode_expr): Update prototype. - * target-memory.c (gfc_target_encode_expr, encode_array, - encode_derived): Return unsigned HOST_WIDE_INT. - (gfc_target_interpret_expr): Add assert. - (gfc_merge_initializers): Fix "== 0" check for mpz_t. - * symbol.c (gfc_get_typebound_proc): Add assert. - (gfc_merge_initializers): Remove unreachable check. - -2012-09-13 Tobias Burnus <burnus@net-b.de> - - PR fortran/54556 - * resolve.c (resolve_formal_arglist): Allow VALUE arguments - with implicit_pure. - (gfc_impure_variable): Don't check gfc_pure such that the - function also works for gfc_implicit_pure procedures. - -2012-09-12 Tobias Burnus <burnus@net-b.de> - - PR fortran/54225 - PR fortran/53306 - * array.c (match_subscript, gfc_match_array_ref): Fix - diagnostic of coarray's '*'. - -2012-09-07 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/54208 - * simplify.c (simplify_bound_dim): Resolve array spec before - proceeding with simplification. - -2012-09-06 Tobias Burnus <burnus@net-b.de> - - PR fortran/54463 - * trans-intrinsic.c (gfc_conv_intrinsic_funcall): Fix matmul - call to BLAS if the default-kind has been promoted. - -2012-09-05 Tobias Burnus <burnus@net-b.de> - - PR fortran/54462 - * symbol.c (gfc_undo_symbols): Avoid NULL pointer dereference. - -2012-09-04 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54435 - PR fortran/54443 - * match.c (gfc_match_select_type): Make sure to only access CLASS_DATA - for BT_CLASS. - -2012-09-03 Tobias Burnus <burnus@net-b.de> - - PR fortran/54467 - * class.c (gfc_find_derived_vtab): Fix disabling of _final - by continuing to generate normal type-bound procedures. - -2012-09-03 Tobias Burnus <burnus@net-b.de> - - * class.c (gfc_find_derived_vtab): Disable ABI-breaking - generation of the "_final" subroutine for now. - -2012-09-03 Tobias Burnus <burnus@net-b.de> - - * class.c (finalize_component): Fixes to the comment. - -2012-09-03 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> - Tobias Burnus <burnus@net-b.de> - - PR fortran/37336 - * gfortran.h (symbol_attribute): Add artificial. - * module.c (mio_symbol_attribute): Handle attr.artificial - * class.c (gfc_build_class_symbol): Defer creation of the vtab - if the DT has finalizers, mark generated symbols as - attr.artificial. - (has_finalizer_component, finalize_component, - finalization_scalarizer, generate_finalization_wrapper): - New static functions. - (gfc_find_derived_vtab): Add _final component and call - generate_finalization_wrapper. - * dump-parse-tree.c (show_f2k_derived): Use resolved - proc_tree->n.sym rather than unresolved proc_sym. - (show_attr): Handle attr.artificial. - * resolve.c (gfc_resolve_finalizers): Ensure that the vtab exists. - (resolve_fl_derived): Resolve finalizers before - generating the vtab. - (resolve_symbol): Also allow assumed-rank arrays with CONTIGUOUS; - skip artificial symbols. - (resolve_fl_derived0): Skip artificial symbols. - -2012-09-02 Tobias Burnus <burnus@net-b.de> - - PR fortran/54426 - * symbol.c (find_common_symtree): New function. - (gfc_undo_symbols): Use it; free common_head if needed. - -2012-08-28 Tobias Burnus <burnus@net-b.de> - - PR fortran/54389 - * trans-decl.c (gfc_get_extern_function_decl, - build_function_decl): Don't mark impure elemental - functions as DECL_PURE_P and honour implicit_pure. - -2012-08-28 Tobias Burnus <burnus@net-b.de> - - PR fortran/54382 - * error.c (show_locus): Avoid out of bound access. - -2012-08-28 Tobias Burnus <burnus@net-b.de> - - PR fortran/54384 - * decl.c (match_data_constant): Add missing gfc_free_expr. - (top_val_list): Remove always-true condition. - * data.c (get_array_index, create_character_initializer): - Free temporary expressions. - (gfc_assign_data_value): Free expression when aborting. - -2012-08-28 Tobias Burnus <burnus@net-b.de> - - PR fortran/54384 - * symbol.c (gfc_copy_formal_args): Set also sym->formal_ns. - -2012-08-27 Tobias Burnus <burnus@net-b.de> - - PR fortran/54384 - * resolve.c (gfc_resolve_character_operator): Free temporary - variables. - * trans-expr.c (gfc_conv_statement_function): Ditto. - -2012-08-27 Tobias Burnus <burnus@net-b.de> - - PR fortran/54384 - * dependency.c (check_section_vs_section): Use gfc_free_expr - instead of free. - * trans-intrinsic.c (conv_generic_with_optional_char_arg): Use - gfc_free_symbol instead of free. - -2012-08-27 Tobias Burnus <burnus@net-b.de> - - PR fortran/54384 - * trans-expr.c (gfc_trans_arrayfunc_assign): Free se.ss - and loop. - -2012-08-27 Tobias Burnus <burnus@net-b.de> - - PR fortran/41093 - * gfortran.h (gfc_common_head): Add "int refs". - * match.c (gfc_match_common): Increment refs. - * resolve.c (resolve_symbol): Only increment formal_ns->refs - if formal_ns is not sym->ns. - * symbol.c (gfc_free_symbol): Only free formal_ns if - if formal_ns is not sym->ns. Free common_block if refs is one. - (gfc_release_symbol): Release formal_ns only if the - symbol is not ENTRY of a module. - * decl.c (get_proc_name): Don't increment gfc_current_ns->refs. - * parse.c (parse_interface): Incement proc_unit->refs++ for - proc-pointer result variables. - * module.c (mio_symbol): Don't increase sym->refs for its - use in sym->formal_ns->proc_name. - -2012-08-27 Tobias Burnus <burnus@net-b.de> - - PR fortran/54370 - * trans-stmt.c (gfc_trans_do_while): Don't change the logical - kind for negation of the condition. - -2012-08-27 Tobias Burnus <burnus@net-b.de> - - * options.c (set_Wall): Don't set for -Wcompare-reals. - * invoke.texi (-Wall, -Wcompare-reals): -Wall no longer - implies -Wcompare-reals. - -2012-08-24 Simon Baldwin <simonb@google.com> - - * lang.opt (-cpp=): Mark flag NoDWARFRecord. - -2012-08-23 Tobias Burnus <burnus@net-b.de> - - PR fortran/54350 - * trans-array.c (free_ss_info): Free data.array.subscript. - (gfc_free_ss): No longer free data.array.subscript. - (walk_coarray): New function, moved from trans-intrinsic.c - (gfc_conv_expr_descriptor): Walk array descriptor instead - of taking passed "ss". - (get_array_ctor_all_strlen, gfc_add_loop_ss_code, - gfc_conv_array_parameter): Update call and cleanup ss handling. - * trans-array.h (gfc_conv_expr_descriptor, - gfc_conv_array_parameter): Update prototype. - * trans-expr.c (gfc_conv_derived_to_class, - conv_isocbinding_procedure, gfc_conv_procedure_call, - gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign, - gfc_trans_pointer_assignment, gfc_trans_arrayfunc_assign): Update - call to gfc_conv_expr_descriptor and gfc_conv_array_parameter, and - clean up. - * trans-intrinsic.c (walk_coarray): Moved to trans-array.c - (trans_this_image, trans_image_index, gfc_conv_intrinsic_rank - gfc_conv_intrinsic_bound, gfc_conv_intrinsic_cobound, - gfc_conv_intrinsic_len, gfc_conv_intrinsic_size, - gfc_conv_intrinsic_sizeof, gfc_conv_intrinsic_storage_size, - gfc_conv_intrinsic_transfer, gfc_conv_allocated, - gfc_conv_associated, gfc_conv_intrinsic_loc, - conv_intrinsic_move_alloc): Update calls. - * trans-io.c (gfc_convert_array_to_string, set_internal_unit, - gfc_trans_transfer): Ditto. - * trans-stmt.c (gfc_conv_elemental_dependencies, - gfc_trans_sync, trans_associate_var, - gfc_trans_pointer_assign_need_temp): Ditto. - -2012-08-23 Jakub Jelinek <jakub@redhat.com> - - * trans-decl.c (trans_function_start, generate_coarray_init, - create_main_function, gfc_generate_constructors): Call - allocate_struct_function instead of init_function_start. - -2012-08-22 Tobias Burnus <burnus@net-b.de> - - * trans-expr.c (gfc_copy_class_to_class, - gfc_trans_arrayfunc_assign): Free loop and ss data. - * trans-intrinsic.c (gfc_trans_arrayfunc_assign): Free ss data. - -2012-08-21 Tobias Burnus <burnus@net-b.de> - - * parse.c (parse_contained): Include EXEC_END_PROCEDURE - in ns->code to make sure the gfc_code is freed. - -2012-08-20 Tobias Burnus <burnus@net-b.de> - - PR fortran/54301 - * expr.c (gfc_check_pointer_assign): Warn when a pointer, - which is a function result, might outlive its target. - -2012-08-20 Tobias Burnus <burnus@net-b.de> - - PR fortran/54301 - * expr.c (gfc_check_pointer_assign): Warn when the pointer - might outlive its target. - * gfortran.h (struct gfc_option_t): Add warn_target_lifetime. - * options.c (gfc_init_options, set_wall, gfc_handle_option): - handle it. - * invoke.texi (-Wtarget-lifetime): Document it. - (-Wall): Implied it. - * lang.opt (-Wtarget-lifetime): New flag. - -2012-08-19 Thomas König <tkoenig@gcc.gnu.org> - - PR fortran/54298 - * gfortran.h (struct gfc_option_t): Add warn_compare_reals. - * lang.opt: Add Wcompare-reals. - * invoke.texi: Document -Wcompare-reals. - * resolve.c (resolve_operator): If -Wcompare-reals is in effect, - warn about equality/inequality comparisions for REAL and COMPLEX. - * options.c (gfc_init_options): Set warn_compare_reals. - (set_Wall): Include warn_compare_reals in Wall. - (gfc_handle_option): Handle Wcompare_reals. - -2012-08-17 Jakub Jelinek <jakub@redhat.com> - - * array.c (gfc_match_array_ref): Fix up memset arguments. - -2012-08-16 Diego Novillo <dnovillo@google.com> - - Revert - - PR bootstrap/54281 - * gfortran.h: Do not include gmp.h. - -2012-08-16 Diego Novillo <dnovillo@google.com> - - PR bootstrap/54281 - * gfortran.h: Do not include gmp.h. - -2012-08-15 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54243 - PR fortran/54244 - * resolve.c (check_typebound_baseobject): Check for class_ok attribute. - (resolve_procedure_interface,resolve_fl_derived0): Copy class_ok - attribute. - -2012-08-14 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/47586 - * trans-expr.c (expr_is_variable): Handle regular, procedure pointer, - and typebound functions returning a data pointer. - -2012-08-14 Mikael Morin <mikael@gcc.gnu.org> - - * decl.c (match_ppc_decl): Copy the procedure interface's symbol - as procedure interface's result. - -2012-08-14 Mikael Morin <mikael@gcc.gnu.org> - - * trans-expr.c (gfc_trans_scalar_assign): Rename argument, - extend comment. - -2012-08-14 Mikael Morin <mikael@gcc.gnu.org> - - * gfortran.h (gfc_get_proc_ptr_comp): New prototype. - (gfc_is_proc_ptr_comp): Update prototype. - * expr.c (gfc_get_proc_ptr_comp): New function based on the old - gfc_is_proc_ptr_comp. - (gfc_is_proc_ptr_comp): Call gfc_get_proc_ptr_comp. - (gfc_specification_expr, gfc_check_pointer_assign): Use - gfc_get_proc_ptr_comp. - * trans-array.c (gfc_walk_function_expr): Likewise. - * resolve.c (resolve_structure_cons, update_ppc_arglist, - resolve_ppc_call, resolve_expr_ppc): Likewise. - (resolve_function): Update call to gfc_is_proc_ptr_comp. - * dump-parse-tree.c (show_expr): Likewise. - * interface.c (compare_actual_formal): Likewise. - * match.c (gfc_match_pointer_assignment): Likewise. - * primary.c (gfc_match_varspec): Likewise. - * trans-io.c (gfc_trans_transfer): Likewise. - * trans-expr.c (gfc_conv_variable, conv_function_val, - conv_isocbinding_procedure, gfc_conv_procedure_call, - gfc_trans_pointer_assignment): Likewise. - (gfc_conv_procedure_call, gfc_trans_array_func_assign): - Use gfc_get_proc_ptr_comp. - -2012-08-14 Tobias Burnus <burnus@net-b.de> - - PR fortran/40881 - * error.c (gfc_notify_std): Reset cur_error_buffer->flag flag - when the error/warning has been printed. - * gfortran.h (gfc_sl_type): Add ST_LABEL_DO_TARGET. - * match.c (gfc_match_do): Use ST_LABEL_DO_TARGET. - * parse.c (check_statement_label): Use ST_LABEL_DO_TARGET. - (parse_executable): Add obsolescence check for DATA. - * resolve.c (resolve_branch): Handle ST_LABEL_DO_TARGET. - * symbol.c (gfc_define_st_label, gfc_reference_st_label): - Add obsolescence diagnostics. - * trans-stmt.c (gfc_trans_label_assign): Handle ST_LABEL_DO_TARGET. - -2012-08-14 Tobias Burnus <burnus@net-b.de> - - PR fortran/54234 - * check.c (gfc_check_cmplx): Add -Wconversion warning - when converting higher-precision REAL to default-precision - CMPLX without kind= parameter. - -2012-08-12 Tobias Burnus <burnus@net-b.de> - - PR fortran/54221 - * trans-decl.c (gfc_finish_var_decl, build_function_decl): - Fix setting private module vars/procs as TREE_PUBLIC(...) = 0. - -2012-08-09 Tobias Burnus <burnus@net-b.de> - - PR fortran/54199 - * intrinsic.c (gfc_warn_intrinsic_shadow): Better warning - for internal procedures. - -2012-08-06 Janus Weil <janus@gcc.gnu.org> - - PR fortran/35831 - * interface.c (check_result_characteristics): New function, which checks - the characteristics of function results. - (gfc_compare_interfaces,gfc_check_typebound_override): Call it. - -2012-08-02 Thomas König <tkoenig@gcc.gnu.org> - - PR fortran/54033 - * scanner.c (add_path_to_list): New argument warn. Don't - warn if it is true. - (gfc_add_include_path): Warn if directory is missing. - (gfc_add_intrinsic_modules_path): Do not warn if directory - is missing. - * optinons.c (gfc_handle_option): Do not add directory - for intrinsic modules to normal include path. - -2012-08-03 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/54166 - * trans-array.c (set_loop_bounds): Access specinfo using spec_dim. - -2012-08-02 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/48820 - * trans-array.c (gfc_conv_ss_startstride): Set the intrinsic - result's lower and upper bounds according to the rank. - (set_loop_bounds): Set the loop upper bound in the intrinsic case. - -2012-08-02 Mikael Morin <mikael@gcc.gnu.org> - - * trans-array.c (set_loop_bounds): Allow non-array-section to be - chosen using the stride and lower bound criteria. - -2012-08-02 Mikael Morin <mikael@gcc.gnu.org> - - * trans-array.c (set_loop_bounds): Remove useless dimension check. - Don't update loopspec if it would loose the wanted stride criterion. - -2012-08-02 Mikael Morin <mikael@gcc.gnu.org> - - * trans-array.h (gfc_conv_descriptor_rank): New prototype. - * trans-array.c (gfc_conv_descriptor_rank): New function moved and - renamed ... - * trans-intrinsic.c (get_rank_from_desc): ... from this one. - (gfc_conv_intrinsic_rank, gfc_conv_intrinsic_bound, - gfc_conv_associated): Also rename function calls. - -2012-08-02 Mikael Morin <mikael@gcc.gnu.org> - - * iresolve.c (resolve_bound, gfc_resolve_shape): - Don't set the shape for assumed rank arrays. - * simplify.c (gfc_simplify_shape): Don't try to simplify if the - argument is assumed rank. - -2012-08-02 Mikael Morin <mikael@gcc.gnu.org> - - * array.c (gfc_copy_array_ref): Don't copy the offset field. - * expr.c (find_array_section): Ignore the offset field. - * trans-expr.c (gfc_find_interface_mapping_to_ref): Don't apply - any interface mapping to the offset field. - * gfortran.h (struct gfc_array_ref): Remove the offset field. - -2012-08-02 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54147 - * resolve.c (check_proc_interface): New routine for PROCEDURE interface - checks. - (resolve_procedure_interface,resolve_typebound_procedure, - resolve_fl_derived0): Call it. - -2012-08-01 Thomas König <tkoenig@gcc.gnu.org> - - PR fortran/54033 - * scanner.c (add_path_to_list): Emit warning if an error occurs - for an include path, if it is not present or if it is not a - directory. Do not add the path in these cases. - -2012-07-31 Janus Weil <janus@gcc.gnu.org> - - PR fortran/42418 - * decl.c (match_procedure_interface): Move some checks to - 'resolve_procedure_interface'. Set flavor if appropriate. - * expr.c (gfc_check_pointer_assign): Cleanup of 'gfc_is_intrinsic'. - * intrinsic.c (gfc_is_intrinsic): Additional checks for attributes which - identify a procedure as being non-intrinsic. - * resolve.c (resolve_procedure_interface): Checks moved here from - 'match_procedure_interface'. Minor cleanup. - (resolve_formal_arglist,resolve_symbol): Cleanup of - 'resolve_procedure_interface' - (resolve_actual_arglist,is_external_proc): Cleanup of - 'gfc_is_intrinsic'. - -2012-07-31 Janus Weil <janus@gcc.gnu.org> - - PR fortran/54134 - * dependency.c (gfc_dep_compare_expr): Check if arguments are NULL. - -2012-07-31 Tobias Burnus <burnus@net-b.de> - - * interface.c (gfc_procedure_use): Return gfc_try instead of void. - * gfortran.h (gfc_procedure_use): Update prototype. - * resolve.c (gfc_iso_c_func_interface): Allow noninteroperable - procedures for c_funloc for TS29113. - * (gfc_iso_c_sub_interface): Ditto for c_f_procpointer. Add - diagnostic for c_ptr vs. c_funptr for c_f_(proc)pointer. - -2012-07-30 Janus Weil <janus@gcc.gnu.org> - - PR fortran/51081 - * gfortran.h (gfc_resolve_intrinsic): Add prototype. - * expr.c (gfc_check_pointer_assign): Set INTRINSIC attribute if needed. - Check for invalid intrinsics. - * primary.c (gfc_match_rvalue): Check for intrinsics came too early. - Set procedure flavor if appropriate. - * resolve.c (resolve_intrinsic): Renamed to gfc_resolve_intrinsic. - (resolve_procedure_interface,resolve_procedure_expression, - resolve_function,resolve_fl_derived0,resolve_symbol): Ditto. - -2012-07-26 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/44354 - * trans-array.c (gfc_trans_array_constructor_value): - Evaluate the iteration bounds before the inner variable shadows - the outer. - -2012-07-26 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/44354 - * array.c (sought_symbol): New variable. - (expr_is_sought_symbol_ref, find_symbol_in_expr): New functions. - (resolve_array_list): Check for references to the induction - variable in the iteration bounds and issue a diagnostic if some - are found. - -2012-07-26 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> - Tobias Burnus <burnus@net-b.de> - - * module.c (mio_array_spec): Don't read as->lower for - assumed-rank arrays. - -2012-07-25 Tobias Burnus <burnus@net-b.de> - - * trans-types.c (gfc_real16_is_float128): Fix spelling - in a comment. - * trans.h (struct gfc_array_info): Ditto. - * gfortran.h (gfc_expr): Ditto. - * simplify.c (gfc_count): Ditto. - * trans-expr.c (gfc_copy_class_to_class, - conv_parent_component_references, - gfc_trans_pointer_assignment): Ditto. - * expr.c (check_pointer_assign): Fix diagnostic spelling. - * interface.c (compare_parameter): Ditto. - * parse.c (use_modules, parse_associate): Ditto. - * decl.c (match_char_length): Fix spelling of the - an function argument. - -2012-07-21 Tobias Burnus <burnus@net-b.de> - - * iso-c-binding.def (C_PTRDIFF_T): New TS29113 parameter. - * intrinsic.texi (ISO_C_BINDING): Document it. - -2012-07-21 Tobias Burnus <burnus@net-b.de> - - PR fortran/48820 - * trans-intrinsic.c (gfc_conv_intrinsic_bound): Support - lbound/ubound with dim= for assumed-rank arrays. - * array.c (gfc_set_array_spec): Reject coarrays with - assumed shape. - * decl.c (merge_array_spec): Ditto. Return gfc_try. - (match_attr_spec, match_attr_spec): Update call. - -2012-07-21 Tobias Burnus <burnus@net-b.de> - - * resolve.c (resolve_formal_arglist): Put variable - declaration before the first assignment. - -2012-07-21 Tobias Burnus <burnus@net-b.de> - - * trans-expr.c (gfc_conv_derived_to_class): Fix argument passed - to class_array_data_assign. - -2012-07-20 Tobias Burnus <burnus@net-b.de> - - * decl.c (gfc_verify_c_interop_param): Allow assumed-shape - with -std=f2008ts. - -2012-07-20 Tobias Burnus <burnus@net-b.de> - - PR fortran/48820 - * array.c (match_array_element_spec, gfc_match_array_spec, - spec_size, gfc_array_dimen_size): Add support for - assumed-rank arrays. - * check.c (dim_rank_check): Ditto. - * class.c (gfc_add_component_ref): Ditto. - (gfc_build_class_symbol): Regard assumed-rank arrays - as having GFC_MAX_DIMENSIONS. And build extra class - container for a scalar pointer class. - * decl.c (merge_array_spec): Add assert. - * dump-parse-tree.c (show_array_spec): Add support for - assumed-rank arrays. - * expr.c (gfc_is_simply_contiguous): Ditto. - * gfortran.h (array_type): Ditto. - (gfc_array_spec, gfc_expr): Add comment to "rank" field. - * interface.c (compare_type_rank, argument_rank_mismatch, - compare_parameter, gfc_procedure_use): Ditto. - (compare_actual_formal): Fix NULL() to optional-dummy - handling for polymorphic dummies. - * module.c (mio_typespec): Add support for - assumed-rank arrays. - * resolve.c (resolve_formal_arglist, resolve_actual_arglist, - resolve_elemental_actual, resolve_global_procedure, - expression_shape, resolve_variable, update_ppc_arglist, - check_typebound_baseobject, gfc_resolve_expr, - resolve_fl_var_and_proc, gfc_resolve_finalizers, - resolve_typebound_procedure, resolve_symbol): Ditto. - (assumed_type_expr_allowed): Remove static variable. - (actual_arg, first_actual_arg): New static variables. - * simplify.c (simplify_bound, gfc_simplify_range): Add - support for assumed-rank arrays. - * trans-array.c (gfc_conv_array_parameter): Ditto. - (gfc_get_descriptor_dimension): New function, which returns - the descriptor. - (gfc_conv_descriptor_dimension): Use it. - (gfc_conv_descriptor_stride_get, gfc_conv_array_parameter): - Handle GFC_ARRAY_ASSUMED_RANK_CONT and AS_ASSUMED_RANK. - * trans-array.h (gfc_get_descriptor_dimension): New prototype. - * trans-decl. (gfc_build_dummy_array_decl, - gfc_trans_deferred_vars, add_argument_checking): Add - support for assumed-rank arrays. - * trans-expr.c (gfc_conv_expr_present, gfc_conv_variable, - gfc_conv_procedure_call): Ditto. - (get_scalar_to_descriptor_type, class_array_data_assign, - conv_scalar_to_descriptor): New static functions. - (gfc_conv_derived_to_class, gfc_conv_class_to_class): Use - them. - * trans-intrinsic.c (get_rank_from_desc): New function. - (gfc_conv_intrinsic_rank, gfc_conv_associated): Use it. - * trans-types.c (gfc_array_descriptor_base_caf, - gfc_array_descriptor_base): Make space for scalar array. - (gfc_is_nodesc_array, gfc_is_nodesc_array, - gfc_build_array_type, gfc_get_array_descriptor_base): Add - support for assumed-rank arrays. - * trans.h (gfc_array_kind): Add GFC_ARRAY_ASSUMED_RANK and - GFC_ARRAY_ASSUMED_RANK_CONT. - -2012-07-19 Tobias Burnus <burnus@net-b.de> - - * trans-expr.c (gfc_conv_procedure_call): Fix handling - of polymorphic arguments. - * resolve.c (resolve_formal_arglist): Ditto, mark polymorphic - assumed-shape arrays as such. - -2012-07-19 Tobias Burnus <burnus@net-b.de> - - * interface.c (compare_parameter, compare_actual_formal): Fix - handling of polymorphic arguments. - -2012-07-17 Janus Weil <janus@gcc.gnu.org> - - PR fortran/51081 - * error.c (gfc_notify_std): Automatically print the relevant Fortran - standard version. - * arith.c (arith_power): Remove explicit standard reference string. - * array.c (gfc_match_array_spec, gfc_match_array_constructor): Ditto. - * check.c (gfc_check_a_p, gfc_check_besn, gfc_check_count, - gfc_check_float, gfc_check_fn_rc2008, gfc_check_iand, - gfc_check_ichar_iachar, gfc_check_ieor, gfc_check_index, gfc_check_ior, - gfc_check_lbound, gfc_check_len_lentrim, check_rest, gfc_check_min_max, - gfc_check_null, gfc_check_scan, gfc_check_selected_real_kind, - gfc_check_shape, gfc_check_size, gfc_check_sngl, gfc_check_ubound, - gfc_check_verify): Ditto. - * data.c (gfc_assign_data_value): Ditto. - * decl.c (var_element, char_len_param_value, match_char_length, - gfc_verify_c_interop_param, match_pointer_init, variable_decl, - gfc_match_decl_type_spec, gfc_match_import, match_attr_spec, - gfc_match_prefix, gfc_match_suffix, match_ppc_decl, - match_procedure_in_interface, gfc_match_procedure,gfc_match_entry, - gfc_match_subroutine, gfc_match_end, gfc_match_codimension, - gfc_match_protected, gfc_match_value, gfc_match_volatile, - gfc_match_asynchronous, gfc_match_modproc, gfc_get_type_attr_spec, - gfc_match_enum, match_procedure_in_type): Ditto. - * expr.c (check_elemental, gfc_check_assign, gfc_check_pointer_assign): - Ditto. - * interface.c (gfc_match_abstract_interface, check_interface0): Ditto. - * intrinsic.c (gfc_intrinsic_func_interface): Ditto. - * io.c (format_lex, resolve_tag_format, resolve_tag, - compare_to_allowed_values, gfc_match_open, gfc_match_rewind, - gfc_resolve_dt, gfc_match_wait): Ditto. - * match.c (match_arithmetic_if, gfc_match_if, gfc_match_critical, - gfc_match_do, match_exit_cycle, gfc_match_pause, gfc_match_stop, - gfc_match_lock, sync_statement, gfc_match_assign, gfc_match_goto, - gfc_match_allocate, gfc_match_return, gfc_match_st_function): Ditto. - * module.c (gfc_match_use, gfc_use_module): Ditto. - * parse.c (parse_derived_contains, parse_block_construct, - parse_associate, parse_contained): Ditto. - * primary.c (match_hollerith_constant, match_boz_constant, - match_real_constant, match_sym_complex_part, match_arg_list_function, - build_actual_constructor, gfc_convert_to_structure_constructor): Ditto. - * resolve.c (resolve_formal_arglist, resolve_entries, - resolve_common_blocks, resolve_actual_arglist, gfc_resolve_index_1, - gfc_resolve_iterator_expr, resolve_ordinary_assign, - resolve_fl_var_and_proc, resolve_fl_variable_derived, - resolve_fl_procedure, resolve_fl_derived0, resolve_fl_derived, - resolve_fl_namelist, resolve_symbol, resolve_fntype): Ditto. - * symbol.c (check_conflict, conflict, gfc_add_is_bind_c, - gfc_add_extension, gfc_check_symbol_typed): Ditto. - -2012-07-17 Tobias Burnus <burnus@net-b.de> - - PR fortran/53985 - * decl.c (gfc_verify_c_interop_param): Make warning conditional - on -Wc-binding-type works and improve the wording. - -2012-07-17 Tobias Burnus <burnus@net-b.de> - - PR fortran/52101 - * decl.c (match_char_length): Extra argument, show obsolenscent - warning only if *length is used after the typename. - (variable_decl, gfc_match_char_spec): Update call - -2012-07-17 Tobias Burnus <burnus@net-b.de> - Steven G. Kargl <kargl@gcc.gnu.org> - - PR fortran/49265 - * decl.c (match_procedure_in_interface): Support "::" for - Fortran 2008 and later. - -2012-07-16 Thomas König <tkoenig@gcc.gnu.org> - - PR fortran/53824 - * resolve.c (resolve_allocate_deallocate): If both - start indices are NULL, skip the test for equality. - -2012-07-16 Steven Bosscher <steven@gcc.gnu.org> - - * f95-lang.c: Include dumpfile.h instead of tree-dump.h. - * Make-lang.in: Fix dependencies. - -2012-07-16 Janus Weil <janus@gcc.gnu.org> - - PR fortran/53956 - * gfortran.h (gfc_copy_formal_args,gfc_copy_formal_args_ppc): Modified - prototypes. - * symbol.c (gfc_copy_formal_args): New argument 'if_src'. Copy if_source - of dummy procedures. - (gfc_copy_formal_args_ppc): Ditto. - * resolve.c (resolve_procedure_interface): Pass IFSRC_DECL to - gfc_copy_formal_args. - (resolve_fl_derived0): Pass IFSRC_DECL to gfc_copy_formal_args_ppc. - -2012-07-12 Tobias Burnus <burnus@net-b.de> - - * trans-expr.c (conv_isocbinding_procedure): Generate c_f_pointer code - inline. - -2012-07-11 Steven Bosscher <steven@gcc.gnu.org> - - * trans.c: Do not include defaults.h. - * trans-intrinsic.c: Likewise. - -2012-07-08 Steven Bosscher <steven@gcc.gnu.org> - - * gfortran.h: Do not include coretypes.h here. - Make it an error to include this before coretypes.h - * openmp.c: Include coretypes.h. - * interface.c: Likewise. - * intrinsic.c: Likewise. - * symbol.c: Likewise. - * class.c: Likewise. - * decl.c: Likewise. - * matchexp.c: Likewise. - * dump-parse-tree.c: Likewise. - * array.c: Likewise. - * constructor.c: Likewise. - * error.c: Likewise. - * data.c: Likewise. - * expr.c: Likewise. - * module.c: Likewise. - * scanner.c: Likewise. - * bbt.c: Likewise. - * io.c: Likewise. - * frontend-passes.c: Likewise. - * resolve.c: Likewise. - * st.c: Likewise. - * target-memory.c: Likewise. - * match.c: Likewise. - * arith.c: Likewise. - * parse.c: Likewise. - * check.c: Likewise. - * dependency.c: Likewise. - * primary.c: Likewise. - * misc.c: Likewise. - * simplify.c: Likewise. - -2012-07-05 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/53732 - * trans-array.c (gfc_add_loop_ss_code): Disable self recursive calls - handling nested loop(s) if the subscript flag is true. - -2012-07-05 Uros Bizjak <ubizjak@gmail.com> - - PR fortran/53449 - * parse.c (gfc_parse_file): Initialize errors_before. - -2012-06-27 Janus Weil <janus@gcc.gnu.org> - - PR fortran/41951 - PR fortran/49591 - * interface.c (check_new_interface): Rename, add 'loc' argument, - make non-static. - (gfc_add_interface): Rename 'check_new_interface' - * gfortran.h (gfc_check_new_interface): Add prototype. - * resolve.c (resolve_typebound_intrinsic_op): Add typebound operator - targets to non-typebound operator list. - -2012-06-22 Janus Weil <janus@gcc.gnu.org> - - PR fortran/47710 - PR fortran/53328 - * interface.c (count_types_test, generic_correspondence, - gfc_compare_interfaces): Ignore PASS arguments. - (check_interface1, compare_parameter): Pass NULL arguments to - gfc_compare_interfaces. - * gfortran.h (gfc_compare_interfaces): Modified prototype. - * expr.c (gfc_check_pointer_assign): Pass NULL arguments to - gfc_compare_interfaces. - * resolve.c (resolve_structure_cons): Ditto. - (check_generic_tbp_ambiguity): Determine PASS arguments and pass them - to gfc_compare_interfaces. - -2012-06-21 Janne Blomqvist <jb@gcc.gnu.org> - - PR fortran/39654 - * iresolve.c (gfc_resolve_ftell): Fix result kind and use new - library function. - -2012-06-18 Tobias Burnus <burnus@net-b.de> - - * intrinsic.h (gfc_resolve_rank): New prototype. - * intrinsic.c (add_functions): Use gfc_resolve_rank. - * iresolve.c (add_functions): New function. - * trans-intrinsic.c (gfc_conv_intrinsic_rank): New function. - (gfc_conv_intrinsic_function): Call it. - -2012-06-18 Tobias Burnus <burnus@net-b.de> - - PR fortran/53692 - * trans-array.c (set_loop_bounds): Don't scalarize via absent - optional arrays. - * resolve.c (resolve_elemental_actual): Don't stop resolving after printing - a warning. - -2012-06-18 Tobias Burnus <burnus@net-b.de> - - PR fortran/53526 - * trans-intrinsic.c (conv_intrinsic_move_alloc): Handle coarrays. - -2012-06-18 Tobias Burnus <burnus@net-b.de> - - PR fortran/53526 - * check.c (gfc_check_move_alloc): Reject coindexed actual arguments - and those with different corank. - -2012-06-17 Tobias Burnus <burnus@net-b.de> - - PR fortran/53691 - PR fortran/53685 - * check.c (gfc_calculate_transfer_sizes): Return if - SIZE= is not constant or source-size cannot be determined. - -2012-06-16 Tobias Burnus <burnus@net-b.de> - - PR fortran/53642 - PR fortran/45170 - * frontend-passes.c (optimize_assignment): Don't remove RHS's - trim when assigning to a deferred-length string. - * trans-expr.c (gfc_trans_assignment_1): Ensure that the RHS string - length is evaluated before the deferred-length LHS is reallocated. - -2012-06-13 Tobias Burnus <burnus@net-b.de> - - PR fortran/53643 - * trans-decl.c (init_intent_out_dt): Fix for polymorphic arrays. - * trans-array.c (structure_alloc_comps): Don't loop for - scalar coarrays. - -2012-06-13 Tobias Burnus <burnus@net-b.de> - - PR fortran/53597 - * decl.c (match_attr_spec): Only mark module variables - as SAVE_IMPLICIT for Fortran 2008 and later. - -2012-06-08 Janus Weil <janus@gcc.gnu.org> - - PR fortran/52552 - * match.c (gfc_match_allocate): Modify order of checks. Change wording - of error message. Remove FIXME note. - * resolve.c (resolve_allocate_expr): Add a comment. - -2012-06-07 Thomas König <tkoenig@gcc.gnu.org> - - PR fortran/52861 - * frontend-passes.c (optimize_assignment): Don't set the - length of an empty string for deferred-length character - variables. - -2012-06-07 Thomas König <tkoenig@gcc.gnu.org> - - PR fortran/52861 - * frontend-passes.c (empty_string): Add prototype. - (optimize_assignment): Set the length of an empty string - constant to zero. - -2012-06-04 Tobias Burnus <burnus@net-b.de> - - PR fortran/50619 - * resolve.c (build_default_init_expr): Don't initialize - ASSOCIATE names. - -2012-06-03 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> - Tobias Burnus <burnus@net-b.de> - - PR fortran/48831 - * gfortran.h (gfc_check_init_expr): Add prototype declaration - of function. - * check.c (kind_check): Change if condition to use - to gfc_check_init_expr. - * expr.c (check_init_expr): Remove forward declaration - and static keyword. Change name in gfc_check_init_expr. - (scalarize_intrinsic_call, check_init_expr_arguments, - check_inquiry, check_conversion, gfc_reduce_init_expr): Update - call to gfc_check_init_expr. - -2012-05-31 Steven Bosscher <steven@gcc.gnu.org> - - * trans-common.c: Do not include output.h. - * trans-decl.c: Likewise. - -2012-05-31 Tobias Burnus <burnus@net-b.de> - - PR fortran/53521 - * trans.c (gfc_deallocate_scalar_with_status): Properly - handle the case size == 0. - -2012-05-30 Tobias Burnus <burnus@net-b.de> - - PR c/53502 - * decl.c (match_attr_spec): Remove "typedef". - -2012-05-30 Tobias Burnus <burnus@net-b.de> - - * decl.c: Fix comment typos. - * expr.c: Ditto. - * frontend-passes.c: Ditto. - * match.c: Ditto. - * resolve.c: Ditto. - * trans-array.c: Ditto. - * trans-common.c: Ditto. - * trans-intrinsic.c: Ditto. - * trans-types.c: Ditto. - -2012-05-23 Tobias Burnus <burnus@net-b.de> - - PR fortran/51055 - PR fortran/45170 - * match.c (gfc_match_allocate): Set length_from_typespec - for characters. - * resolve.c (resolve_charlen): If set, don't check whether - the len is a specification expression. - -2012-05-22 Tobias Burnus <burnus@net-b.de> - - PR fortran/53389 - * trans-array.c (gfc_add_loop_ss_code): Don't evaluate expression, if - ss->is_alloc_lhs is set. - -2012-05-22 Dodji Seketeli <dodji@redhat.com> - - PR c++/53322 - * f95-lang.c (gfc_init_builtin_functions): Remove the unused - typedef builtin_type. - -2012-05-14 Janne Blomqvist <jb@gcc.gnu.org> - - PR fortran/52428 - * gfortran.texi: Update _gfortran_set_options documentation. - * invoke.texi: Remove runtime behavior description of - -fno-range-check. - * trans-decl.c (create_main_function): Don't pass the range-check - setting to the library. - -2012-05-14 Tobias Burnus <burnus@net-b.de> - - PR fortran/49110 - PR fortran/51055 - PR fortran/53329 - * trans-expr.c (gfc_trans_assignment_1): Fix allocation - handling for assignment of function results to allocatable - deferred-length strings. - * trans-decl.c (gfc_create_string_length): For deferred-length - module variables, include module name in the assembler name. - (gfc_get_symbol_decl): Don't override the assembler name. - -2012-05-14 Manuel López-Ibáñez <manu@gcc.gnu.org> - - PR 53063 - * options.c (gfc_handle_option): Call lang-specific generated function. - -2012-05-13 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> - Tobias Burnus <burnus@net-b.de> - - PR fortran/52158 - PR fortran/45170 - PR fortran/49430 - * resolve.c (resolve_fl_derived0): Deferred character length - procedure components are supported. - * trans-expr.c (gfc_conv_procedure_call): Handle TBP with - deferred-length results. - (gfc_string_to_single_character): Add a new check to prevent - NULL read. - (gfc_conv_procedure_call): Remove unuseful checks on - symbol's attributes. Add new checks to prevent NULL read on - string length. - -2012-05-12 Tobias Burnus <burnus@net-b.de> - - PR fortran/49110 - PR fortran/52843 - * resolve.c (resolve_fl_procedure): Don't regard - character(len=:) as character(*) in the diagnostic. - -2012-05-11 Thomas Koenig <tkoenig@gcc.gnu.org> - - PR fortran/52537 - * frontend-passes.c (optimize_op): Change - old-style comparison operators to new-style, simplify - switch as a result. - (empty_string): New function. - (get_len_trim_call): New function. - (optimize_comparison): If comparing to an empty string, - use comparison of len_trim to zero. - Use new-style comparison operators only. - (optimize_trim): Use get_len_trim_call. - -2012-05-11 Manuel López-Ibáñez <manu@gcc.gnu.org> - - PR 53063 - * options.c: Include diagnostics.h instead of - diagnostics-core.h. - (set_Wall): Do not see warn_unused here. - (gfc_handle_option): Set it here using handle_generated_option. - -2012-05-08 Jan Hubicka <jh@suse.cz> - - * trans-common.c (create_common): Do not fake TREE_ASM_WRITTEN. - * trans-decl.c (gfc_finish_cray_pointee): Likewise. - -2012-05-07 Tobias Burnus <burnus@net-b.de> - - PR fortran/53255 - * resolve.c (resolve_typebound_static): Fix handling - of overridden specific to generic operator. - -2012-05-06 Tobias Burnus <burnus@net-b.de> - - PR fortran/41587 - * decl.c (build_struct): Don't ignore FAILED status. - -2012-05-05 Paul Thomas <pault@gcc.gnu.org> - - PR fortran/41600 - * trans-array.c (build_array_ref): New static function. - (gfc_conv_array_ref, gfc_get_dataptr_offset): Call it. - * trans-expr.c (gfc_get_vptr_from_expr): New function. - (gfc_conv_derived_to_class): Add a new argument for a caller - supplied vptr and use it if it is not NULL. - (gfc_conv_procedure_call): Add NULL to call to above. - symbol.c (gfc_is_associate_pointer): Return true if symbol is - a class object. - * trans-stmt.c (trans_associate_var): Handle class associate- - names. - * expr.c (gfc_get_variable_expr): Supply the array-spec if - possible. - * trans-types.c (gfc_typenode_for_spec): Set GFC_CLASS_TYPE_P - for class types. - * trans.h : Add prototypes for gfc_get_vptr_from_expr and - gfc_conv_derived_to_class. Define GFC_CLASS_TYPE_P. - * resolve.c (resolve_variable): For class arrays, ensure that - the target expression has all the necessary _data references. - (resolve_assoc_var): Throw a "not yet implemented" error for - class array selectors that need a temporary. - * match.c (copy_ts_from_selector_to_associate, - select_derived_set_tmp, select_class_set_tmp): New functions. - (select_type_set_tmp): Call one of last two new functions. - (gfc_match_select_type): Copy_ts_from_selector_to_associate is - called if associate-name is typed. - - PR fortran/53191 - * resolve.c (resolve_ref): C614 applied to class expressions. - -2012-05-05 Janne Blomqvist <jb@gcc.gnu.org> - - PR fortran/49010 - PR fortran/24518 - * intrinsic.texi (MOD, MODULO): Mention sign and magnitude of result. - * simplify.c (gfc_simplify_mod): Use mpfr_fmod. - (gfc_simplify_modulo): Likewise, use copysign to fix the result if - zero. - * trans-intrinsic.c (gfc_conv_intrinsic_mod): Remove fallback as - builtin_fmod is always available. For modulo, call copysign to fix - the result when signed zeros are enabled. - -2012-05-05 Janne Blomqvist <jb@gcc.gnu.org> - - * gfortran.texi (GFORTRAN_TMPDIR): Rename to TMPDIR, explain - algorithm for choosing temp directory. - -2012-05-04 Tobias Burnus <burnus@net-b.de> - - PR fortran/53175 - * resolve.c (resolve_variable): Set public_used - if a private module variable is used in a (public) - specification expression. - * trans-decl.c (gfc_finish_var_decl): Mark those - TREE_PUBLIC. - -2012-05-04 Tobias Burnus <burnus@net-b.de> - - PR fortran/53111 - * resolve.c (resolve_fl_derived): Fix -std=f95 - diagnostic for generic vs. DT names. - -2012-05-03 Tobias Burnus <burnus@net-b.de> - - PR fortran/52864 - * interface.c (compare_parameter_intent): Remove. - (check_intents): Remove call, handle CLASS pointer. - (compare_actual_formal): Handle CLASS pointer. - -2012-04-30 Jan Hubicka <jh@suse.cz> - - * f95-lang.c (gfc_finish): Update comments. - -2012-04-29 Thomas Koenig <tkoenig@gcc.gnu.org> - - PR fortran/53148 - * frontend-passes.c (create_var): If the statement has a label, - put the label around the block. - -2012-04-25 Tobias Burnus <burnus@net-b.de> - - PR fortran/52196 - * lang.opt (Wrealloc-lhs, Wrealloc-lhs-all): New flags. - * gfortran.h (gfc_option_t): Add them. - * options.c (gfc_init_options, gfc_post_options, - gfc_handle_option): Handle them. - * invoke.texi: Document them. - * trans-expr.c (realloc_lhs_warning): New function. - (gfc_trans_arrayfunc_assign, - alloc_scalar_allocatable_for_assignment, - gfc_trans_assignment_1): Use it. - -2012-04-18 Steven Bosscher <steven@gcc.gnu.org> - - * trans-decl.c (gfc_trans_entry_master_switch): Build SWITCH_EXPR - with NULL_TREE type instead of void_type_node. - * trans-io.c (io_result): Likewise. - * trans-stmt.c (gfc_trans_integer_select, - gfc_trans_character_select): Likewise. - -2012-04-16 Tobias Burnus <burnus@net-b.de> - - PR fortran/52864 - * expr.c (gfc_check_vardef_context): Fix assignment check for - pointer components. - -2012-04-16 Janus Weil <janus@gcc.gnu.org> - - PR fortran/52968 - * class.c (gfc_build_class_symbol): Make sure the 'f2k_derived' - namespace is present. - -2012-04-15 Janus Weil <janus@gcc.gnu.org> - - PR fortran/51082 - * trans-expr.c (gfc_conv_expr_reference): Check if the expression is a - simple function call (or a more involved PPC reference). - -2012-04-15 Tobias Burnus <burnus@net-b.de> - - PR fortran/52916 - PR fortran/40973 - * gfortran.h (symbol_attribute): Add public_used. - * interface.c (check_sym_interfaces, check_uop_interfaces, - gfc_check_interfaces): Set it. - * resolve.c (resolve_typebound_procedure): Ditto. - * trans-decl.c (build_function_decl): Use it. - -2012-04-11 Tobias Burnus <burnus@net-b.de> - - PR fortran/52729 - * resolve.c (resolve_symbol): Fix searching for parent NS decl. - -2012-04-08 Tobias Burnus <burnus@net-b.de> - - PR fortran/52751 - * trans-decl.c (gfc_finish_var_decl): Don't set TREE_PUBLIC - for PRIVATE module variables without C-binding label. - - PR fortran/40973 - * trans-decl.c (build_function_decl): Ditto for procedures. - -2012-04-07 Thomas Koenig <tkoenig@gcc.gnu.org> - - PR fortran/52893 - * frontend-passes.c: Keep track of wether we are in an implicit - DO loop; do not do function elimination if we are. - -2012-04-06 Thomas Koenig <tkoenig@gcc.gnu.org> - - PR fortran/52668 - * module.c: Only mark symbols as use_only if they have been - imported via an only list. - -2012-03-28 Paul Thomas <pault@gcc.gnu.org> - Tobias Burnus <burnus@gcc.gnu.org> - - PR fortran/52652 - * match.c (gfc_match_allocate, gfc_match_deallocate): Change - "not.. or" to "neither.. nor". - * parse.c (decode_specification_statement): Correct error in - chpice of matching function for "allocatable". - -2012-03-23 Janne Blomqvist <jb@gcc.gnu.org> - - * gfortran.h (GFC_MAX_LINE): Remove unused macro. - -2012-03-19 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> - - PR fortran/52559 - * error.c (gfc_widechar_display_length): Consider tabs as - one character wide, as they're displayed as spaces. - (show_locus): Move tab handling to... - (print_wide_char_into_buffer): ... here. - -2012-03-17 Tobias Burnus <burnus@net-b.de> - - PR fortran/52585 - * trans-intrinsic.c (gfc_conv_associated): Fix handling of - procpointer dummy arguments. - -2012-03-16 Janne Blomqvist <jb@gcc.gnu.org> - - * trans-intrinsic.c (build_round_expr): Don't use BUILT_IN_IROUND - for __float128. - -2012-03-15 Janne Blomqvist <jb@gcc.gnu.org> - - * f95-lang.c (gfc_init_builtin_functions): Initialize - BUILT_IN_IROUND. - * mathbuiltins.def: Add IROUND. - * trans-intrinsic.c (build_round_expr): Use BUILT_IN_IROUND if - type size matches. - (gfc_build_intrinsic_lib_fndecls): Build iround functions. - -2012-03-12 Richard Guenther <rguenther@suse.de> - - * f95-lang.c (builtin_type_for_size): Use gfc_type_for_size. - -2012-03-12 Tobias Burnus <burnus@net-b.de> - - PR fortran/52542 - * decl.c (match_procedure_decl): If the interface - is bind(C), the procedure is as well. - -2012-03-10 Steven Bosscher <steven@gcc.gnu.org> - - * convert.c (convert): Fold BOOLEAN_TYPE types to the proper variant. - -2012-03-09 Steven Bosscher <steven@gcc.gnu.org> - - * Make-lang.in (convert.o): Depend on convert.h. - * convert.c: Header and comment cleanups. - (gfc_thruthvalue_conversion): Rename static function - to truthvalue_conversion. Do not use 'internal_error' from here, - use 'gcc_unreachable' instead. - (convert): Do not use 'error' for conversions to void, use - 'gcc_unreachable' instead. Likewise for conversions to non-scalar - types. Do not hanlde ENUMERAL_TYPE, the front end never creates them. - Clean up #if 0 code. - -2012-03-08 Tobias Burnus <burnus@net-b.de> - - PR fortran/52469 - * trans-types.c (gfc_get_function_type): Handle backend_decl - of a procedure pointer. - -2012-03-06 Steven Bosscher <steven@gcc.gnu.org> - - * f95-lang.c (yyerror, yylex): Remove. - (clear_binding_stack): Remove, fold into its only user. - (LANG_HOOKS_PRINT_IDENTIFIER): Do not re-define. - (ridpointers): Remove. - (gfc_eh_initialized_p): Make static. - (gfc_truthvalue_conversion): Move to convert.c. - (gfc_be_parse_file): Clear binding level stack when done. - (gfc_print_identifier): Remove. - (pushlevel): Remove ignored 'ignore' argument. Update all callers. - (poplevel): Remove unused 'reverse' argument. Update all callers. - (ggc_p): Remove. - (gfc_builtin_function): Make static. Do not attempt to make RTL for - builtin functions. - * convert.c (gfc_truthvalue_conversion): Moved here from f95-lang.c, - and made static. - * trans.h (pushlevel, poplevel): Adjust prototypes. - (gfc_truthvalue_conversion, gfc_builtin_function): Remove prototypes. - * trans-openmp.c: Update calls to pushlevel and poplevel. - * trans.c: Likewise. - * trans-decl.c: Likewise. - -2012-03-04 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/50981 - * gfortran.h (gfc_is_class_container_ref): New prototype. - * class.c (gfc_is_class_container_ref): New function. - * trans-expr.c (gfc_conv_procedure_call): Add a "_data" component - reference to polymorphic actual arguments. - -2012-03-04 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/50981 - * trans-expr.c (gfc_conv_procedure_call): Save se->ss's value. - Handle the case of unallocated arrays passed to elemental procedures. - -2012-03-04 Mikael Morin <mikael@gcc.gnu.org> - - * trans.h (struct gfc_ss_info): Move can_be_null_ref component from - the data::scalar subcomponent to the toplevel. - * trans-expr.c (gfc_conv_expr): Update component reference. - * trans-array.c (gfc_add_loop_ss_code): Ditto. - (gfc_walk_elemental_function_args): Ditto. Move the conditional setting - the field out of the scalar-only block. - -2012-03-04 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> - - PR fortran/36160 - * error.c (gfc_widechar_display_length, gfc_wide_display_length): - New functions. - (print_wide_char_into_buffer): Return length written. - (show_locus): Fix locus displayed when wide characters are present. - -2012-03-04 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> - - * module.c (gfc_use_module): Improve error message some more. - -2012-03-03 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> - - PR fortran/52313 - * module.c (gfc_use_module): Improve error messages. - -2012-03-03 Tobias Burnus <burnus@net-b.de> - - PR fortran/48820 - * resolve.c (resolve_actual_arglist): Properly reset - assumed_type_expr_allowed. - -2012-03-03 Tobias Burnus <burnus@net-b.de> - - * lang.opt (Wc-binding-type): New flag. - * options.c (gfc_init_options, gfc_handle_option): Handle it. - * invoke.texi (Wc-binding-type): Document it. - * gfortran.h (gfc_option_t): Add warn_c_binding_type. - * decl.c (verify_bind_c_sym): Handle -Wc-binding-type. - * symbol.c (gfc_set_default_type, verify_bind_c_derived_type): - Ditto. - -2012-03-03 Tobias Burnus <burnus@net-b.de> - - PR fortran/48820 - * decl.c (gfc_match_decl_type_spec): Support type(*). - (gfc_verify_c_interop): Allow type(*). - * dump-parse-tree.c (show_typespec): Handle type(*). - * expr.c (gfc_copy_expr): Ditto. - * interface.c (compare_type_rank, compare_parameter, - compare_actual_formal, gfc_procedure_use): Ditto. - * libgfortran.h (bt): Add BT_ASSUMED. - * misc.c (gfc_basic_typename, gfc_typename): Handle type(*). - * module.c (bt_types): Ditto. - * resolve.c (assumed_type_expr_allowed): New static variable. - (resolve_actual_arglist, resolve_variable, resolve_symbol): - Handle type(*). - * trans-expr.c (gfc_conv_procedure_call): Ditto. - * trans-types.c (gfc_typenode_for_spec, gfc_get_dtype): Ditto. - -2012-03-02 Tobias Burnus <burnus@net-b.de> - - PR fortran/52325 - * primary.c (gfc_match_varspec): Add missing ;. - -2012-03-02 Tobias Burnus <burnus@net-b.de> - - PR fortran/52325 - * primary.c (gfc_match_varspec): Add diagnostic for % with - nonderived types. - -2012-03-02 Tobias Burnus <burnus@net-b.de> - - PR fortran/52270 - * expr.c (gfc_check_vardef_context): Fix check for - intent-in polymorphic pointer . - * interface.c (compare_parameter): Allow passing TYPE to - intent-in polymorphic pointer. - -2012-03-02 Tobias Burnus <burnus@net-b.de> - - PR fortran/52452 - * resolve.c (resolve_intrinsic): Don't search for a - function if we know that it is a subroutine. - -2012-02-29 Paul Thomas <pault@gcc.gnu.org> - - PR fortran/52386 - * trans-expr.c (fcncall_realloc_result): Dereference the - descriptor if needed. - -2012-02-22 Tobias Burnus <burnus@net-b.de> - - PR fortran/52335 - * io.c (gfc_match_open): Remove bogus F2003 DELIM= check. - -2012-02-18 Tobias Burnus <burnus@net-b.de> - - PR fortran/52295 - * interface.c (check_interface0): Internal procs in - generic interfaces are allowed in Fortran 2008. - -2012-02-17 Tobias Burnus <burnus@net-b.de> - Roland Stigge <stigge@antcom.de> - - PR translation/52273 - * interface.c (compare_actual_formal): Fix typo "at at". - -2012-02-17 Tobias Burnus <burnus@net-b.de> - - * gfortran.texi (Q exponent-letter): Fix grammar. - -2012-02-17 Tobias Burnus <burnus@net-b.de> - - * gfortran.texi (Status): Fix typos. - * invoke.texi (ffixed-form, fstack-arrays): Spell Fortran with - a majuscule. - -2012-02-17 Tobias Burnus <burnus@net-b.de> - Roland Stigge <stigge@antcom.de> - - PR translation/52232 - PR translation/52234 - PR translation/52245 - PR translation/52246 - PR translation/52262 - PR translation/52273 - * io.c (gfc_match_open): Fix typo. - * interface.c (compare_actual_formal): Ditto. - * lang.opt (freal-4-real-8, freal-4-real-16, freal-8-real-16): Ditto. - * match.c (alloc_opt_list, gfc_match_nullify): Ditto. - * check.c (gfc_check_associated, gfc_check_null): Ditto. - -2012-02-12 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/50981 - * trans-stmt.c (gfc_get_proc_ifc_for_call): New function. - (gfc_trans_call): Use gfc_get_proc_ifc_for_call. - -2012-02-12 Mikael Morin <mikael@gcc.gnu.org> - - * trans-array.c (gfc_walk_elemental_function_args, - gfc_walk_function_expr): Move call to gfc_get_proc_ifc_for_expr out - of gfc_walk_elemental_function_args. - * trans-stmt.c (gfc_trans_call): Ditto. - * trans-array.h (gfc_get_proc_ifc_for_expr): New prototype. - (gfc_walk_elemental_function_args): Update prototype. - -2012-02-12 Mikael Morin <mikael@gcc.gnu.org> - - * trans-array.c (gfc_get_proc_ifc_for_expr): New function. - (gfc_walk_elemental_function_args): Move code to - gfc_get_proc_ifc_for_expr and call it. - -2012-02-08 Tobias Burnus <burnus@net-b.de> - - PR fortran/52151 - * trans-expr.c (fcncall_realloc_result): Set also the stride. - -2012-02-07 Tobias Burnus <burnus@net-b.de> - - PR fortran/51514 - * trans-expr.c (gfc_conv_procedure_call): Add _data component - for calls of scalar CLASS actuals to TYPE dummies. - -2012-02-05 Thomas König <tkoenig@gcc.gnu.org> - - PR fortran/48847 - * trans-decl.c: Warn about unused dummy procedure arguments - if -Wunused-dummy-argument is specified. Suppress middle-end - warnings about procedure arguments. - -2012-02-05 Paul Thomas <pault@gcc.gnu.org> - - * trans-array.c (gfc_array_allocate): Zero memory for all class - array allocations. - * trans-stmt.c (gfc_trans_allocate): Ditto for class scalars. - - PR fortran/52102 - * trans-stmt.c (gfc_trans_allocate): Before correcting a class - array reference, ensure that 'dataref' points to the _data - component that is followed by the array reference.. - -2012-02-02 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/41587 - PR fortran/46356 - PR fortran/51754 - PR fortran/50981 - * class.c (insert_component_ref, class_data_ref_missing, - gfc_fix_class_refs): New functions. - * gfortran.h (gfc_fix_class_refs): New prototype. - * trans-expr.c (gfc_conv_expr): Remove special case handling and call - gfc_fix_class_refs instead. - -2012-02-02 Paul Thomas <pault@gcc.gnu.org> - - PR fortran/52012 - * trans-expr.c (fcncall_realloc_result): If variable shape is - correct, retain the bounds, whatever they are. - -2012-02-02 Tobias Burnus <burnus@net-b.de> - - PR fortran/52093 - * simplify.c (gfc_simplify_size): Handle INTRINSIC_PARENTHESES. - -2012-02-01 Thomas König <tkoenig@gcc.gnu.org> - - PR fortran/51958 - * frontend-passes.c (convert_elseif): New function. - (optimize_namespace): Call it. - -2012-02-01 Tobias Burnus <burnus@net-b.de> - - PR fortran/52024 - * module.c (MOD_VERSION): Bump. - (mio_typebound_proc): Read/write is_operator from/to the - .mod file. - -2012-02-01 Tobias Burnus <burnus@net-b.de> - - PR fortran/52059 - * trans-expr.c (gfc_conv_procedure_call): Add array ref - only to variables. - -2012-01-31 Tobias Burnus <burnus@net-b.de> - - PR fortran/52024 - * gfortran.h (gfc_tbp_generic): Store whether the - generic is an operator. - * decl.c (gfc_match_generic): Set that flag. - * resolve.c (check_generic_tbp_ambiguity): Use it in the - gfc_compare_interfaces check. - -2012-01-31 Tobias Burnus <burnus@net-b.de> - - PR fortran/52029 - * class.c (gfc_find_derived_vtab): Mark _copy function as pure. - -2012-01-31 Tobias Burnus <burnus@net-b.de> - - PR fortran/52013 - * class.c (get_unique_hashed_string): Adapt trim length. - (gfc_build_class_symbol) Encode also corank in the container name. - -2012-01-31 Paul Thomas <pault@gcc.gnu.org> - - PR fortran/52012 - * trans-expr.c (fcncall_realloc_result): Correct calculation of - result offset. - -2012-01-29 Janne Blomqvist <jb@gcc.gnu.org> - - * module.c (pointer_info): Make true_name and module pointers - rather than arrays, order pointers before other fields. - (free_pi_tree): free true_name and module as well. - (mio_read_string): Rename to read_string. - (mio_write_string): Remove. - (load_commons): Use read_string. - (read_module): Use read_string rather than mio_internal_string. - (write_blank_common): Call write_atom directly. - (write_symbol): Likewise. - -2012-01-29 Tobias Burnus <burnus@net-b.de> - - PR fortran/41600 - * expr.c (gfc_default_initializer): Convert the values if - the type does not match. - -2012-01-29 Tobias Burnus <burnus@net-b.de> - - PR fortran/51972 - * trans-array.c (structure_alloc_comps): Fix assignment of - polymorphic components (polymorphic deep copying). - -2012-01-29 Janne Blomqvist <jb@gcc.gnu.org> - - PR fortran/51808 - * decl.c (set_binding_label): Make binding_label argument const. - (curr_binding_label): Constify. - * gfortran.h (gfc_symbol): Constify binding_label. - (gfc_common_head): Likewise. - (get_iso_c_sym): Likewise. - * match.c (gfc_match_name_C): Constify buffer argument. - * match.h (gfc_match_name_C): Likewise. - * resolve.c (set_name_and_label): Constify binding_label argument. - (gfc_iso_c_sub_interface): Constify binding_label variable. - * symbol.c (get_iso_c_sym): Constify binding_label argument. - -2012-01-29 Janne Blomqvist <jb@gcc.gnu.org> - - PR fortran/51808 - * decl.c (set_binding_label): Move prototype from match.h to here. - (curr_binding_label): Make a pointer rather than static array. - (build_sym): Check sym->binding_label pointer rather than array, - update set_binding_label call, handle curr_binding_label changes. - (set_binding_label): Handle new curr_binding_label, dest_label - double ptr, and sym->binding_label. - (verify_bind_c_sym): Handle sym->binding_label being a pointer. - (set_verify_bind_c_sym): Check sym->binding_label pointer rather - than array, update set_binding_label call. - (gfc_match_bind_c_stmt): Handle curr_binding_label change. - (match_procedure_decl): Update set_binding_label call. - (gfc_match_bind_c): Change binding_label to pointer, update - gfc_match_name_C call. - * gfortran.h (GFC_MAX_BINDING_LABEL_LEN): Remove macro. - (gfc_symbol): Make binding_label a pointer. - (gfc_common_head): Likewise. - * match.c (gfc_match_name_C): Heap allocate bind(C) name. - * match.h (gfc_match_name_C): Change prototype argument. - (set_binding_label): Move prototype to decl.c. - * module.c (struct pointer_info): Make binding_label a pointer. - (free_pi_tree): Free unused binding_label. - (mio_read_string): New function. - (mio_write_string): New function. - (load_commons): Redo reading of binding_label. - (read_module): Likewise. - (write_common_0): Change to write empty string instead of name if - no binding_label. - (write_blank_common): Write empty string for binding label. - (write_symbol): Change to write empty string instead of name if no - binding_label. - * resolve.c (gfc_iso_c_func_interface): Don't set binding_label. - (set_name_and_label): Make binding_label double pointer, use - asprintf. - (gfc_iso_c_sub_interface): Make binding_label a pointer. - (resolve_bind_c_comms): Handle cases if - gfc_common_head->binding_label is NULL. - (gfc_verify_binding_labels): sym->binding_label is a pointer. - * symbol.c (gfc_new_symbol): Rely on XCNEW zero init for - binding_label. - (gen_special_c_interop_ptr): Don't set binding label. - (generate_isocbinding_symbol): Insert binding_label into symbol - table. - (get_iso_c_sym): Use pointer assignment instead of strcpy. - * trans-common.c (gfc_sym_mangled_common_id): Handle - com->binding_label being a pointer. - * trans-decl.c (gfc_sym_mangled_identifier): Handle - sym->binding_label being a pointer. - (gfc_sym_mangled_function_id): Likewise. - -2012-01-29 Tobias Burnus <burnus@net-b.de> - - PR fortran/52038 - * resolve.c (symbol_as): Remove unused, accidentally - added function. - -2012-01-28 Tobias Burnus <burnus@net-b.de> - - PR fortran/51972 - * trans-stmt.c (gfc_trans_allocate): Properly check whether - we have a BT_CLASS which needs to be memset. - -2012-01-27 Tobias Burnus <burnus@net-b.de> - - PR fortran/52022 - * trans-expr.c (gfc_conv_procedure_call): Fix passing - of functions, which return allocatables. - -2012-01-27 Tobias Burnus <burnus@net-b.de> - - PR fortran/52016 - * resolve.c (resolve_formal_arglist): Fix elemental - constraint checks for polymorphic dummies also for - pointers. - -2012-01-27 Tobias Burnus <burnus@net-b.de> - - PR fortran/51970 - PR fortran/51977 - * primary.c (gfc_match_varspec. gfc_match_rvalue): Set - handle array spec for BT_CLASS. - * expr.c (gfc_get_variable_expr, gfc_lval_expr_from_sym) - * frontend-passes.c (create_var): Ditto. - * resolve.c (resolve_actual_arglist, resolve_assoc_var): Ditto. - * trans-decl.c (gfc_trans_deferred_vars): Use class_pointer - instead of attr.pointer. - (gfc_generate_function_code): Use CLASS_DATA (sym) for BT_CLASS. - * trans-intrinsic.c (conv_intrinsic_move_alloc): Move assert. - * trans-stmt.c (trans_associate_var): Ask for the descriptor. - -2012-01-27 Tobias Burnus <burnus@net-b.de> - - PR fortran/51953 - * match.c (gfc_match_allocate): Allow more than allocate - object with SOURCE=. - -2012-01-27 Tobias Burnus <burnus@net-b.de> - - PR fortran/52016 - * resolve.c (resolve_formal_arglist): Fix elemental - constraint checks for polymorphic dummies. - -2012-01-27 Paul Thomas <pault@gcc.gnu.org> - Tobias Burnus <burnus@gcc.gnu.org> - - PR fortran/48705 - PR fortran/51870 - PR fortran/51943 - PR fortran/51946 - * trans-array.c (gfc_array_init_size): Add two extra arguments - to convey the dynamic element size of a calls object and to - return the number of elements that have been allocated. - (gfc_array_allocate): Add the same arguments and use them to - call gfc_array_init_size. Before the allocation dereference - the data pointer, if necessary. Set the allocated array to zero - if the class element size or expr3 are non-null. - * trans-expr.c (gfc_conv_class_to_class): Give this function - global scope. - (get_class_array_ref): New function. - (gfc_copy_class_to_class): New function. - * trans-array.h : Update prototype for gfc_array_allocate. - * trans-stmt.c (gfc_trans_allocate): For non-variable class - STATUS expressions extract the class object and the dynamic - element size. Use the latter to call gfc_array_allocate and - the former for setting the vptr and, via - gfc_copy_class_to_clasfc_cs, to copy to the allocated data. - * trans.h : Prototypes for gfc_get_class_array_ref, - gfc_copy_class_to_class and gfc_conv_class_to_class. - -2012-01-25 Tobias Burnus <burnus@net-b.de> - - * resolve.c (symbol_as): Check also for attr.class_ok. - -2012-01-25 Tobias Burnus <burnus@net-b.de> - - PR fortran/51995 - * class.c (gfc_build_class_symbol): Fix invalid freeing - issue with fclass->f2k_derived. - -2012-01-25 Tobias Burnus <burnus@net-b.de> - - PR fortran/51995 - * class.c (gfc_build_class_symbol): Ensure that - fclass->f2k_derived is set. - -2012-01-25 Tobias Burnus <burnus@net-b.de> - - PR fortran/51966 - * resolve.c (resolve_structure_cons): Only create an - array constructors for nonscalars. - -2012-01-23 Tobias Burnus <burnus@net-b.de> - - PR fortran/51948 - * check.c (variable_check): Fix checking for - variables and deeply nested BLOCKs. - -2012-01-21 Tobias Burnus <burnus@net-b.de> - Steven G. Kargl <kargl@gcc.gnu.org> - - PR fortran/50556 - * symbol.c (check_conflict): namelist-group-name cannot have the SAVE - attribute. - -2012-01-21 Tobias Burnus <burnus@net-b.de> - - PR fortran/51913 - * interface.c (compare_parameter): Fix CLASS comparison. - -2012-01-20 Tobias Burnus <burnus@net-b.de> - Janus Weil <janus@gcc.gnu.org> - - PR fortran/51056 - * module.c (load_needed, read_module): Don't mark __vtab etc. - as use_only. - -2012-01-19 Tobias Burnus <burnus@net-b.de> - - PR fortran/51904 - * expr.c (gfc_build_intrinsic_call): Also set the symtree. - -2012-01-18 Paul Thomas <pault@gcc.gnu.org> - - PR fortran/51634 - * trans-expr.c (gfc_conv_procedure_call): Deallocate allocatable - components of temporary class arguments. - -2012-01-17 Tobias Burnus <burnus@net-b.de> - Janne Blomqvist <jb@gcc.gnu.org> - - PR fortran/51869 - * trans-expr.c (alloc_scalar_allocatable_for_assignment): Nullify - LHS after allocation, if it has allocatable components. - * f95-lang.c (gfc_init_builtin_functions): Add BUILT_IN_CALLOC. - -2012-01-16 Mikael Morin <mikael@gcc.gnu.org> - Tobias Burnus <burnus@net-b.de> - - PR fortran/50981 - * trans-array.c (gfc_walk_elemental_function_args): Fix - passing of deallocated allocatables/pointers as absent argument. - -2012-01-16 Tobias Burnus <burnus@net-b.de> - - PR fortran/51809 - * class.c (gfc_find_derived_vtab): Mark __vtab and - __def_init as FL_VARIABLE not as FL_PARAMETER. - * expr.c (gfc_simplify_expr): Remove special - handling of __vtab. - * resolve.c (resolve_values): Ditto. - * trans-decl.c (gfc_get_symbol_decl): Mark __vtab - and __def_init as TREE_READONLY. - -2012-01-16 Zydrunas Gimbutas <gimbutas@cims.nyu.edu> - Andreas Kloeckner <kloeckner@cims.nyu.edu> - Steven G. Kargl <kargl@gcc.gnu.org> - - PR fortran/48426 - * gfortran.h (gfc_option_t): Add members flag_*_kind to store kind. - * lang.opt: Add options -freal-4-real-8, -freal-4-real-10, - -freal-4-real-16, -freal-8-real-4, -freal-8-real-10, -freal-8-real-16 - and -finteger-4-integer-8. User-desired type conversion information. - * decl.c (gfc_match_old_kind_spec,kind_expr): Type conversions - in declaration parsing. - * trans-types.c (gfc_init_kinds): User-specified type conversion - checked for current backend. - * primary.c (match_integer_constant,match_real_constant): Implement - type conversion in constant parsing. - * options.c (gfc_init_options,gfc_handle_option): Translate input - options to flags in internal options data structure. - * invoke.texi: Document new options. Re-order options in Options - summary section. - -2012-01-16 Paul Thomas <pault@gcc.gnu.org> - - * trans-array.c (gfc_trans_create_temp_array): In the case of a - class array temporary, detect a null 'eltype' on entry and use - 'initial' to provde the class reference and so, through the - vtable, the element size for the dynamic type. - * trans-stmt.c (gfc_conv_elemental_dependencies): For class - expressions, set 'eltype' to null and pass the values via the - 'initial' expression. - -2012-01-14 Tobias Burnus <burnus@net-b.de> - - PR fortran/51800 - * resolve.c (build_default_init_expr): Also initialize - nonconstant-length strings with -finit-character=<n>. - -2011-01-14 Tobias Burnus <burnus@net-b.de> - - PR fortran/51816 - * module.c (read_module): Don't make nonexisting - intrinsic operators as found. - (rename_list_remove_duplicate): New function. - (gfc_use_modules): Use it. - -2012-01-13 Paul Thomas <pault@gcc.gnu.org> - - PR fortran/48351 - * trans-array.c (structure_alloc_comps): Suppress interative - call to self, when current component is deallocated using - gfc_trans_dealloc_allocated. - * class.c (gfc_build_class_symbol): Copy the 'alloc_comp' - attribute from the declared type to the class structure. - -2012-01-13 Tobias Burnus <burnus@net-b.de> - - PR fortran/51842 - * fortran/trans-types.c (gfc_init_kinds): Use PTRDIFF_TYPE - instead of a signed int of size POINTER_SIZE for - gfc_index_integer_kind. - -2012-01-12 Tobias Burnus <burnus@net-b.de> - - PR fortran/36755 - * intrinsic.texi (CHMOD): Extend a bit and remove statement - that /bin/chmod is called. - -2012-01-10 Gerald Pfeifer <gerald@pfeifer.com> - - * gfortran.texi (Fortran 2003 Status): Fix grammar. - -2012-01-10 Tobias Burnus <burnus@net-b.de> - - PR fortran/51652 - * resolve.c (resolve_allocate_expr): For non-deferred char lengths, - check whether type-spec matches declaration. - -2012-01-10 Tobias Burnus <burnus@net-b.de> - - * resolve.c (resolve_ordinary_assign): Improve error wording. - -2012-01-09 Paul Thomas <pault@gcc.gnu.org> - - PR fortran/51791 - * interface.c (matching_typebound_op): Drill down through - possible parentheses to obtain base expression. Do not test for - 'class_ok' but, instead for the class structure components. - * resolve.c (resolve_ordinary_assign): Extend error message for - polymorphic assignment to advise checking for specific - subroutine. - - PR fortran/51792 - * resolve.c (resolve_typebound_function): Restore 'static' to - declaration. - -2012-01-09 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/51758 - * trans-array.c (gfc_walk_elemental_function_args): - Skip over NULL() actual arguments. - -2012-01-09 Tobias Burnus <burnus@net-b.de> - - * gfortran.texi: Bump copyright year. - (Fortran 2003 Status): Update polymorphism item, add - item for generic interface with DT name. - -2012-01-09 Tobias Burnus <burnus@net-b.de> - - PR fortran/51578 - * gfortran.h (gfc_use_list): - * match.h (gfc_use_module): Rename to ... - (gfc_use_modules): ... this. - * module.c (use_locus, specified_nonint, specified_int): Remove - global variable. - (module_name): Change type to const char*, used with gfc_get_string. - (module_list): New global variable. - (free_rename): Free argument not global var. - (gfc_match_use): Save match to module_list. - (load_generic_interfaces, read_module): Don't free symtree. - (write_dt_extensions, gfc_dump_module): Fix module-name I/O due to the - type change of module_name. - (write_symbol0, write_generic): Optimize due to the type change. - (import_iso_c_binding_module, use_iso_fortran_env_module): Use - locus of rename->where. - (gfc_use_module): Take module_list as argument. - (gfc_use_modules): New function. - (gfc_module_init_2, gfc_module_done_2): Init module_list, rename_list. - * parse.c (last_was_use_stmt): New global variable. - (use_modules): New function. - (decode_specification_statement, decode_statement): Move USE match up - and call use_modules. - (next_free, next_fixed): Call use_modules. - (accept_statement): Don't call gfc_module_use. - -2012-01-06 Tobias Burnus <burnus@net-b.de> - - * trans-openmp.c (gfc_omp_clause_dtor, gfc_trans_omp_array_reduction): - Update call to gfc_trans_dealloc_allocated. - * trans.c (gfc_allocate_using_malloc): Fix spacing. - (gfc_allocate_allocatable): For gfc_allocate_using_lib, jump to - label_finish when an error occurs. - (gfc_deallocate_with_status): Call caf_deregister for -fcoarray=lib. - * trans.h (gfc_allocate_allocatable, gfc_deallocate_with_status): - Update prototype. - (gfor_fndecl_caf_deregister): New tree symbol. - * trans-expr.c (gfc_conv_procedure_call): Update - gfc_deallocate_with_status and gfc_trans_dealloc_allocated calls. - * trans-array.c (gfc_array_allocate, gfc_trans_dealloc_allocated, - structure_alloc_comps, gfc_trans_deferred_array): Ditto. - (gfc_array_deallocate): Handle coarrays with -fcoarray=lib. - * trans-array.h (gfc_array_deallocate, gfc_array_allocate, - gfc_trans_dealloc_allocated): Update prototypes. - * trans-stmt.c (gfc_trans_sync): Fix indentation. - (gfc_trans_allocate): Fix errmsg padding and label handling. - (gfc_trans_deallocate): Ditto and handle -fcoarray=lib. - * expr.c (gfc_is_coarray): Fix algorithm for BT_CLASS. - * libgfortran.h (GFC_STAT_STOPPED_IMAGE): Use large value - to avoid other stats accidentally matching this one. - * trans-decl.c (gfor_fndecl_caf_deregister): New global var. - (gfc_build_builtin_function_decls): Fix prototype decl of caf_register - and add decl for caf_deregister. - (gfc_trans_deferred_vars): Handle CAF vars with -fcoarrays=lib. - * trans-intrinsic.c (conv_intrinsic_move_alloc): Update call to - gfc_deallocate_with_status. - -2012-01-05 Paul Thomas <pault@gcc.gnu.org> - - PR fortran/PR48946 - * resolve.c (resolve_typebound_static): If the typebound - procedure is 'deferred' try to find the correct specific - procedure in the derived type operator space itself. - -2012-01-04 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/50981 - * trans-array.h (gfc_walk_elemental_function_args): New argument. - * trans-intrinsic.c (gfc_walk_intrinsic_function): Update call. - * trans-stmt.c (gfc_trans_call): Ditto. - * trans-array.c (gfc_walk_function_expr): Ditto. - (gfc_walk_elemental_function_args): Get the dummy argument list - if possible. Check that the dummy and the actual argument are both - optional, and set can_be_null_ref accordingly. - -2012-01-04 Mikael Morin <mikael@gcc.gnu.org> - - PR fortran/50981 - * trans.h (struct gfc_ss_info): New field data::scalar::can_be_null_ref - * trans-array.c: If the reference can be NULL, save the reference - instead of the value. - * trans-expr.c (gfc_conv_expr): If we have saved a reference, - dereference it. - -2012-01-04 Mikael Morin <mikael@gcc.gnu.org> - - * trans-expr.c (gfc_conv_expr): Move address taking... - (gfc_conv_expr_reference): ... here. - -2012-01-04 Thomas Koenig <tkoenig@gcc.gnu.org> - - PR fortran/49693 - * trans-common.c (create_common): Update copyright years. Mark - variables as used to avoid warnings about unused variables in - common blocks. - -2012-01-03 Hans-Peter Nilsson <hp@axis.com> - - * gfortran.h (struct gfc_expr): Add missing "struct" - qualifier for member base_expr. - -2012-01-02 Paul Thomas <pault@gcc.gnu.org> - - PR fortran/51529 - * trans-array.c (gfc_array_allocate): Null allocated memory of - newly allocted class arrays. - - PR fortran/46262 - PR fortran/46328 - PR fortran/51052 - * interface.c(build_compcall_for_operator): Add a type to the - expression. - * trans-expr.c (conv_base_obj_fcn_val): New function. - (gfc_conv_procedure_call): Use base_expr to detect non-variable - base objects and, ensuring that there is a temporary variable, - build up the typebound call using conv_base_obj_fcn_val. - (gfc_trans_class_assign): Pick out class procedure pointer - assignments and do the assignment with no further prcessing. - (gfc_trans_class_array_init_assign, gfc_trans_class_init_assign - gfc_trans_class_assign): Move to top of file. - * gfortran.h : Add 'base_expr' field to gfc_expr. - * resolve.c (get_declared_from_expr): Add 'types' argument to - switch checking of derived types on or off. - (resolve_typebound_generic_call): Set the new argument. - (resolve_typebound_function, resolve_typebound_subroutine): - Set 'types' argument for get_declared_from_expr appropriately. - Identify base expression, if not a variable, in the argument - list of class valued calls. Assign it to the 'base_expr' field - of the final expression. Strip away all references after the - last class reference. + * class.c (gfc_class_null_initializer): Fix finding the vtab. + (gfc_find_intrinsic_vtab): Use BT_VOID for some components. -2012-01-02 Tobias Burnus <burnus@net-b.de> +2013-01-03 Janus Weil <janus@gcc.gnu.org> - PR fortran/51682 - * trans-intrinsic.c (trans_this_image, trans_image_index, - trans_num_images, conv_intrinsic_cobound): Fold_convert the - caf_num_images/caf_this_images variables to the correct int kind. + PR fortran/55855 + * expr.c (gfc_check_assign): Use 'gfc_expr_attr' to evaluate attributes + of rvalue. Correct hyphenation in error message. -2012-01-01 Jakub Jelinek <jakub@redhat.com> +2013-01-03 Jakub Jelinek <jakub@redhat.com> * gfortranspec.c (lang_specific_driver): Update copyright notice dates. -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2013 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright diff --git a/gcc/fortran/ChangeLog-2012 b/gcc/fortran/ChangeLog-2012 new file mode 100644 index 00000000000..5045220f038 --- /dev/null +++ b/gcc/fortran/ChangeLog-2012 @@ -0,0 +1,2798 @@ +2012-12-28 Janus Weil <janus@gcc.gnu.org> + + PR fortran/55692 + * check.c (gfc_check_associated): Remove a "gcc_assert (0)". + +2012-12-28 Tobias Burnus <burnus@net-b.de> + + PR fortran/55763 + * check.c (gfc_check_move_alloc): Handle unlimited polymorphic. + * trans-intrinsic.c (conv_intrinsic_move_alloc): Ditto. + +2012-12-27 Jerry DeLisle <jvdelisle@gcc.gnu.org> + + PR fortran/48976 + * gfortran.h (gfc_inquire struct): Add pointer for inquire stream. + * io.c (io_tag): Add tag for inquire stream. (match_inquire_element): + Add matcher for new tag. (gfc_resolve_inquire): Resolve new tag. + * ioparm.def: Add new parameter for inquire stream. + * trans-io.c (gfc_trans_inquire): Add tranlste code for inquire + stream. + +2012-12-23 Tobias Burnus <burnus@net-b.de> + + PR fortran/54884 + * module.c (write_symbol1_recursion): Set attr.public_use. + * interface.c (check_sym_interfaces, check_uop_interfaces, + gfc_check_interfaces): Remove attr.public_use code. + * resolve.c (resolve_function, resolve_variable, + resolve_typebound_procedure): Ditto. + +2012-12-22 Tobias Burnus <burnus@net-b.de> + + PR fortran/55763 + * module.c (mio_component): Don't skip _hash's initializer. + * resolve.c (resolve_select_type): Add an assert. + * trans-expr.c (gfc_conv_procedure_call): Handle + INTENT(OUT) for UNLIMIT_POLY. + +2012-12-21 Richard Biener <rguenther@suse.de> + + PR bootstrap/54659 + * gfortran.h: Do not include gmp.h here. + +2012-12-21 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/55763 + * match.c (select_type_set_tmp): Return is a derived type or + class typespec has no derived type. + * resolve.c (resolve_fl_var_and_proc): Exclude select type + temporaries from 'pointer'. + (resolve_symbol): Exclude select type temporaries from tests + for assumed size and assumed rank. + +2012-12-20 Janus Weil <janus@gcc.gnu.org> + + PR fortran/36044 + * gfortran.h (gfc_isym_id): Add GFC_ISYM_BACKTRACE. + * intrinsic.c (add_subroutines): Add "backtrace". + * intrinsic.texi (BACKTRACE): Document BACKTRACE intrinsic. + +2012-12-20 Tobias Burnus <burnus@net-b.de> + + PR fortran/54818 + * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ensure that + the string length is of type gfc_charlen_type_node. + +2012-12-19 Paul Thomas <pault@gcc.gnu.org> + + * array.c (resolve_array_list): Apply C4106. + * check.c (gfc_check_same_type_as): Exclude polymorphic + entities from check for extensible types. Improved error + for disallowed argument types to name the offending type. + * class.c : Update copyright date. + (gfc_class_null_initializer): Add argument for initialization + expression and deal with unlimited polymorphic typespecs. + (get_unique_type_string): Give unlimited polymorphic + entities a type string. + (gfc_intrinsic_hash_value): New function. + (gfc_build_class_symbol): Incorporate unlimited polymorphic + entities. + (gfc_find_derived_vtab): Deal with unlimited polymorphic + entities. + (gfc_find_intrinsic_vtab): New function. + * decl.c (gfc_match_decl_type_spec): Match typespec for + unlimited polymorphic type. + (gfc_match_data_decl): Skip to 'ok' if unlimited polymorphic. + expr.c (gfc_check_pointer_assign): Apply C717. If unlimited + polymorphic lvalue, find rvalue vtable for all typespecs, + except unlimited polymorphic expressions. + (gfc_check_vardef_context): Handle unlimited polymorphic + entities. + * gfortran.h : Add unlimited polymorphic attribute. Add + second arg to gfc_class_null_initializer primitive and + primitive for gfc_find_intrinsic_vtab. Add UNLIMITED_POLY + to detect unlimited polymorphic expressions. + * interface.c (gfc_compare_types): If expr1 is unlimited + polymorphic, always return 1. If expr2 is unlimited polymorphic + enforce C717. + (gfc_compare_interfaces): Skip past conditions that do not + apply for unlimited polymorphic entities. + (compare_parameter): Make sure that an unlimited polymorphic, + allocatable or pointer, formal argument is matched by an + unlimited polymorphic actual argument. + (compare_actual_formal): Ensure that an intrinsic vtable exists + to match an unlimited polymorphic formal argument. + * match.c (gfc_match_allocate): Type kind parameter does not + need to match an unlimited polymorphic allocate-object. + (alloc_opt_list): An unlimited polymorphic allocate-object + requires a typespec or a SOURCE tag. + (select_intrinsic_set_tmp): New function. + (select_type_set_tmp): Call new function. If it returns NULL, + build a derived type or class temporary instead. + (gfc_match_type_is): Remove restriction to derived types only. + Bind(C) or sequence derived types not permitted. + * misc (gfc_typename): Printed CLASS(*) for unlimited + polymorphism. + * module.c : Add AB_UNLIMITED_POLY to pass unlimited + polymorphic attribute to and from modules. + * resolve.c (resolve_common_vars): Unlimited polymorphic + entities cannot appear in common blocks. + (resolve_deallocate_expr): Deallocate unlimited polymorphic + enities. + (resolve_allocate_expr): Likewise for allocation. Make sure + vtable exists. + (gfc_type_is_extensible): Unlimited polymorphic entities are + not extensible. + (resolve_select_type): Handle unlimited polymorphic selectors. + Ensure that length type parameters are assumed and that names + for intrinsic types are generated. + (resolve_fl_var_and_proc): Exclude select type temporaries + from test of extensibility of type. + (resolve_fl_variable): Likewise for test that assumed character + length must be a dummy or a parameter. + (resolve_fl_derived0): Return SUCCESS unconditionally for + unlimited polymorphic entities. Also, allow unlimited + polymorphic components. + (resolve_fl_derived): Return SUCCESS unconditionally for + unlimited polymorphic entities. + (resolve_symbol): Return early with unlimited polymorphic + entities. + * simplifiy.c : Update copyright year. + (gfc_simplify_extends_type_of): No simplification possible + for unlimited polymorphic arguments. + * symbol.c (gfc_use_derived): Nothing to do for unlimited + polymorphic "derived type". + (gfc_type_compatible): Return unity if ts1 is unlimited + polymorphic. + * trans-decl.c (create_function_arglist) Formal arguments + without a character length should be treated in the same way + as passed lengths. + (gfc_trans_deferred_vars): Nullify the vptr of unlimited + polymorphic pointers. Avoid unlimited polymorphic entities + triggering gcc_unreachable. + * trans-expr.c (gfc_conv_intrinsic_to_class): New function. + (gfc_trans_class_init_assign): Make indirect reference of + src.expr. + (gfc_trans_class_assign): Expression NULL of unknown type + should set NULL vptr on lhs. Treat C717 cases where lhs is + a derived type and the rhs is unlimited polymorphic. + (gfc_conv_procedure_call): Handle the conversion of a non-class + actual argument to match an unlimited polymorphic formal + argument. Suppress the passing of a character string length + in this case. Make sure that calls to the character __copy + function have two character string length arguments. + (gfc_conv_initializer): Pass the initialization expression to + gfc_class_null_initializer. + (gfc_trans_subcomponent_assign): Ditto. + (gfc_conv_structure): Move handling of _size component. + trans-intrinsic.c: (gfc_conv_same_type_as): Handle conditions + where unlimited polymorphic arguments have null vptr. + * trans-stmt.c (trans_associate_var): Correctly treat array + temporaries associated with unlimited polymorphic selectors. + Recover the overwritten dtype for the descriptor. Use the _size + field of the vptr for character string lengths. + (gfc_trans_allocate): Cope with unlimited polymorphic allocate + objects; especially with character source tags. + (reset_vptr): New function. + (gfc_trans_deallocate): Call it. + * trans-types.c (gfc_get_derived_type): Detect unlimited + polymorphic types and deal with cases where the derived type of + components is null. + * trans.c : Update copyright year. + (trans_code): Call gfc_trans_class_assign for C717 cases where + the lhs is not unlimited polymorphic. + +2012-12-19 Tobias Burnus <burnus@net-b.de> + + PR fortran/55733 + * trans-decl.c (gfc_create_string_length): Avoid setting + TREE_STATIC for automatic variables with -fno-automatic. + +2012-12-19 Tobias Burnus <burnus@net-b.de> + Jakub Jelinek <jakub@redhat.com> + Janus Weil <janus@gcc.gnu.org> + + PR fortran/55636 + PR fortran/55733 + * gfortran.h (GFC_PREFIX): Define. + * trans-decl.c (gfc_create_string_length): For VAR_DECLs that + will be TREE_STATIC, use GFC_PREFIX to mangle the names. Handle + -fno-automatic + (gfc_trans_deferred_vars): Don't free variables SAVEd via + -fno-automatic. + +2012-12-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/55197 + * module.c (gfc_use_module): Free rename list only for + internally generated intrinsic modules. + +2012-12-16 Tobias Burnus <burnus@net-b.de> + + * trans-intrinsic.c (conv_intrinsic_move_alloc): Set dynamic + type of the FROM variable to the declared type. + +2012-12-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/55638 + * resolve.c (resolve_formal_arglist): Allow VALUE without + INTENT for ELEMENTAL procedures. + +2012-12-10 Janus Weil <janus@gcc.gnu.org> + + PR fortran/52909 + * trans-decl.c (get_proc_pointer_decl): Apply name mangling. + +2012-12-09 Tobias Burnus <burnus@net-b.de> + + * trans-array.c (structure_alloc_comps): Use NULL_TREE in the + call to gfc_deallocate_scalar_with_status. + * trans-decl.c (gfc_trans_deferred_vars): Pass symbol. + * trans-stmt.c (gfc_trans_deallocate): Pass polymorphic variable. + +2012-12-09 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/55593 + * frontend-passes.c (doloop_code): Use resolved_sym + instead of n.sym->formal for formal argument list + to get the correct version for all generic subroutines. + +2012-12-05 Tobias Burnus <burnus@net-b.de> + + * resolve.c (generate_component_assignments): Fix memleak. + +2012-12-03 Janus Weil <janus@gcc.gnu.org> + + PR fortran/55548 + * intrinsic.texi (SYSTEM_CLOCK): Update documentation of SYSTEM_CLOCK. + +2012-12-03 Tobias Burnus <burnus@net-b.de> + Janus Weil <janus@gcc.gnu.org> + + PR fortran/37336 + * class.c (gfc_is_finalizable): New function. + * gfortran.h (gfc_is_finalizable): Its prototype. + * module.c (mio_component): Read initializer for vtype's _final. + * resolve.c (resolve_fl_derived0): Call gfc_is_finalizable. + * trans-expr.c (gfc_vtable_final_get): New function. + (conv_parent_component_references): Fix comment. + (gfc_conv_variable): Fix for scalar coarray components. + * trans-intrinsic.c (conv_intrinsic_move_alloc): For BT_CLASS, + pass the BT_CLASS type and not the declared type to + gfc_deallocate_scalar_with_status. + * trans.h (gfc_vtable_final_get): New prototype. + +2012-12-03 Tobias Burnus <burnus@net-b.de> + + PR fortran/55475 + * scanner.c (gfc_next_char_literal): Fix setting locus + to free_line_length for the error message. + * error.c (show_locus): Fix potential out-of-bounds + read. + +2012-12-03 Tobias Burnus <burnus@net-b.de> + + PR fortran/37336 + * class.c (finalizer_insert_packed_call): New static function. + (finalize_component, generate_finalization_wrapper): + Fix coarray handling and packing. + +2012-12-02 Paul Thomas <pault@gcc.gnu.org> + + * resolve.c (resolve_allocate_deallocate, + resolve_typebound_intrinsic_op): Recover revisions 193568 and + 193778, which were accidentally reverted by the previous patch. + +2012-12-01 Alessandro Fanfarillo <alessandro.fanfarillo@gmail.com> + Paul Thomas <pault@gcc.gnu.org> + + PR fortran/46897 + * gfortran.h : Add bit field 'defined_assign_comp' to + symbol_attribute structure. + Add primitive for gfc_add_full_array_ref. + * expr.c (gfc_add_full_array_ref): New function. + (gfc_lval_expr_from_sym): Call new function. + * resolve.c (add_comp_ref): New function. + (build_assignment): New function. + (get_temp_from_expr): New function + (add_code_to_chain): New function + (generate_component_assignments): New function that calls all + the above new functions. + (resolve_code): Call generate_component_assignments. + (check_defined_assignments): New function. + (resolve_fl_derived0): Call check_defined_assignments. + (gfc_resolve): Reset component_assignment_level in case it is + left in a bad state by errors. + + + * resolve.c (is_sym_host_assoc, resolve_procedure_interface, + resolve_contained_fntype, resolve_procedure_expression, + resolve_elemental_actual, resolve_global_procedure, + is_scalar_expr_ptr, gfc_iso_c_func_interface, resolve_function, + set_name_and_label, gfc_iso_c_sub_interface, + resolve_specific_s0, resolve_operator, compare_bound_mpz_t, + gfc_resolve_character_operator, resolve_typebound_function, + gfc_resolve_expr, forall_index, remove_last_array_ref, + conformable_arrays, resolve_allocate_expr, + resolve_allocate_deallocate, resolve_select_type, + resolve_transfer, resolve_where, + gfc_resolve_where_code_in_forall, gfc_resolve_forall_body, + gfc_count_forall_iterators, resolve_values, + resolve_bind_c_comms, resolve_bind_c_derived_types, + gfc_verify_binding_labels, apply_default_init, + build_default_init_expr, apply_default_init_local, + resolve_fl_var_and_proc, resolve_fl_procedure, + gfc_resolve_finalizers, check_generic_tbp_ambiguity, + resolve_typebound_intrinsic_op, resolve_typebound_procedure, + resolve_typebound_procedures, ensure_not_abstract, + resolve_fl_derived0, resolve_fl_parameter, resolve_symbol, + resolve_equivalence_derived): Remove trailing white space. + * gfortran.h : Remove trailing white space. + +2012-11-28 Tobias Burnus <burnus@net-b.de> + + PR fortran/52161 + * trans-stmt.c (gfc_trans_sync): Fix bound checking + for -fcoarray=lib. + +2012-11-28 Tobias Burnus <burnus@net-b.de> + + PR fortran/52161 + * trans-stmt.c (gfc_trans_sync): Fix bound checking. + +2012-11-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/55476 + * expr.c (gfc_check_pointer_assign): Fix check + pointer-might-outlive-target check for host_assoc. + +2012-11-26 Eric Botcazou <ebotcazou@adacore.com> + + * trans-decl.c (gfc_finish_var_decl): Do not set DECL_RESTRICTED_P. + +2012-11-26 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54997 + * decl.c (match_procedure_decl): Don't set 'referenced' attribute + for PROCEDURE declarations. + * parse.c (gfc_fixup_sibling_symbols,parse_contained): Don't set + 'referenced' attribute for all contained procedures. + * trans-decl.c (gfc_get_symbol_decl): Allow for unreferenced procedures. + (build_function_decl): Set TREE_USED for referenced procedures. + +2012-11-26 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54881 + * match.c (select_derived_set_tmp,select_class_set_tmp): Removed and + unified into ... + (select_type_set_tmp): ... this one. Set POINTER argument according to + selector. + * trans-intrinsic.c (gfc_conv_associated): Use 'gfc_class_data_get' + instead of 'gfc_add_data_component'. + +2012-11-25 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/30146 + * frontend-passes.c (doloop_warn): New function. + (doloop_list): New static variable. + (doloop_size): New static variable. + (doloop_level): New static variable. + (gfc_run_passes): Call doloop_warn. + (doloop_code): New function. + (doloop_function): New function. + (gfc_code_walker): Keep track of DO level. + +2012-11-24 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/55314 + * resolve.c (resolve_allocate_deallocate): Compare all + subscripts when deciding if to reject a (de)allocate + statement. + +2012-11-21 Janus Weil <janus@gcc.gnu.org> + + PR fortran/55352 + * trans-decl.c (generate_local_decl): Don't warn for explicitly imported + but unused module variables which are in a namelist or common block. + +2012-11-20 Diego Novillo <dnovillo@google.com> + Jakub Jelinek <jakub@redhat.com> + + * trans-openmp.c: Replace all vec<T, A>() initializers + with vNULL. + +2012-11-17 Diego Novillo <dnovillo@google.com> + + Adjust for new vec API (http://gcc.gnu.org/wiki/cxx-conversion/cxx-vec) + + * frontend-passes.c: Use new vec API in vec.h. + * trans-array.c: Likewise. + * trans-common.c: Likewise. + * trans-decl.c: Likewise. + * trans-expr.c: Likewise. + * trans-intrinsic.c: Likewise. + * trans-openmp.c: Likewise. + * trans-stmt.c: Likewise. + * trans-types.c: Likewise. + * trans.h: Likewise. + +2012-11-17 Jakub Jelinek <jakub@redhat.com> + + PR fortran/55341 + * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Convert last + argument to memcpy to size_type_node type. + * trans-stmt.c (gfc_conv_elemental_dependencies): Likewise. + * trasn-array.c (duplicate_allocatable): Likewise. + +2012-11-16 Janus Weil <janus@gcc.gnu.org> + + PR fortran/55297 + * resolve.c (resolve_typebound_intrinsic_op): Only add typebound + operators to the operator list in the namespace of the derived type. + + +2012-11-12 Jan Hubicka <jh@suse.cz> + + * f95-lang.c (ATTR_NOTHROW_LEAF_MALLOC_LIST): New macro. + (gfc_define_builtin): Use set_call_expr_flags. + (gfc_init_builtin_functions): Update. + +2012-11-12 Tobias Burnus <burnus@net-b.de> + + PR fortran/55272 + * module.c (mio_array_spec): Correctly handle coarray + scalars. + +2012-11-07 Tobias Schlüter <tobi@gcc.gnu.org> + + PR fortran/51727 + * module.c (sorted_pointer_info): New. + (gfc_get_sorted_pointer_info): New. + (free_sorted_pointer_info_tree): New. + (compare_sorted_pointer_info): New. + (find_symbols_to_write): New. + (write_symbol1_recursion): New. + (write_symbol1): Collect symbols that need writing, output in order. + (write_generic): Traverse tree in order. + +2012-11-07 Manuel López-Ibáñez <manu@gcc.gnu.org> + + PR c/53063 + * options.c (set_Wall): Do not set warn_switch here. + +2012-11-06 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54917 + * target-memory.c (gfc_target_expr_size,gfc_target_interpret_expr): + Handle BT_CLASS. + * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Add support for + polymorphic arguments. + +2012-11-04 Janus Weil <janus@gcc.gnu.org> + + PR fortran/55199 + * primary.c (gfc_match_varspec): Clear typespec if it cannot be + determined at this point. + +2012-10-31 Janus Weil <janus@gcc.gnu.org> + + PR fortran/53718 + * trans.h (GFC_DECL_PUSH_TOPLEVEL): Removed. + * trans-decl.c (gfc_get_symbol_decl,gfc_generate_function_code): Remove + GFC_DECL_PUSH_TOPLEVEL. + (build_function_decl): Do not push __copy procedure to toplevel. + +2012-10-31 Tobias Burnus <burnus@net-b.de> + + PR fortran/55134 + * trans-array.c (gfc_conv_array_parameter): Regard AS_DEFERRED as + array with descriptor. + +2012-10-28 Tobias Burnus <burnus@net-b.de> + + PR fortran/54958 + * gfortran.h (gfc_resolve_iterator_expr, + gfc_check_vardef_context): Update prototype. + * expr.c (gfc_check_vardef_context): Add own_scope + argument and honour it. + * resolve.c (gfc_resolve_iterator_expr): Add own_scope + argument and honour it. + (resolve_deallocate_expr, resolve_allocate_expr, + resolve_data_variables, resolve_transfer + resolve_lock_unlock, resolve_code): Update calls. + * array.c (resolve_array_list): Ditto. + * check.c (gfc_check_atomic_def, gfc_check_atomic_ref): Ditto. + * interface.c (compare_actual_formal): Ditto. + * intrinsic.c (check_arglist): Ditto. + * io.c (resolve_tag, gfc_resolve_dt, gfc_resolve_inquire): Ditto. + +2012-10-27 Thomas Koenig <tkoenig@gcc.gnu.org> + + * trans.c (gfc_allocate_allocatable): Revert accidental + commit. + +2012-10-24 Janus Weil <janus@gcc.gnu.org> + + PR fortran/55037 + * trans-expr.c (gfc_conv_procedure_call): Move a piece of code and + remove an assert. + +2012-10-21 Tobias Burnus <burnus@net-b.de> + + PR fortran/54725 + * Make-lang.in (CFLAGS-cpp.o): Use TARGET_SYSTEM_ROOT_DEFINE. + * cpp.o (gfc_cpp_init_options): Use it for + setting gfc_cpp_option.sysroot. + +2012-10-21 Thomas König <tkoenig@gcc.gnu.org> + + PR fortran/54465 + * lang.opt (Wextra): Add. + * invoke.texi: Document that -Wc-binding-type, -Wconversion + and -Wline-truncation are implied by -Wall. Document that + -Wcompare-reals is implied by -Wextra. Document -Wextra. + * options.c (set_Wextra): New function. + (gfc_handle_option): Handle -Wextra. + +2012-10-19 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54224 + * trans-expr.c (conv_function_val): Set TREE_USED. + +2012-10-18 Tobias Burnus <burnus@net-b.de> + + PR fortran/54884 + * resolve.c (specification_expr): Change to bool. + (resolve_formal_arglist, resolve_symbol): Set + specification_expr to true before resolving the array spec. + (resolve_variable, resolve_charlen, resolve_fl_variable): + Properly reset specification_expr. + (resolve_function): Set public_use when used in + a specification expr. + +2012-10-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/50981 + PR fortran/54618 + * trans.h (gfc_conv_derived_to_class, gfc_conv_class_to_class): + Update prototype. + * trans-stmt.c (trans_associate_var,gfc_trans_allocate): Update + calls to those functions. + * trans-expr.c (gfc_conv_derived_to_class, gfc_conv_class_to_class, + gfc_conv_expr_present): Handle absent polymorphic arguments. + (class_scalar_coarray_to_class): New function. + (gfc_conv_procedure_call): Update calls. + +2012-10-12 Janus Weil <janus@gcc.gnu.org> + + PR fortran/40453 + * interface.c (check_dummy_characteristics): Recursively check dummy + procedures. + +2012-10-11 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54784 + * trans-stmt.c (gfc_trans_allocate): Correctly determine the reference + to the _data component for polymorphic allocation with SOURCE. + +2012-10-06 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54832 + * resolve.c (resolve_fl_derived0): Correctly copy the 'class_ok' + attribute for proc-ptr components with RESULT variable. + +2012-10-06 Janus Weil <janus@gcc.gnu.org> + + PR fortran/45521 + * interface.c (generic_correspondence): Implement additional + distinguishability criteria of F08. + (compare_actual_formal): Reject data object as actual argument for + procedure formal argument. + +2012-10-04 Tobias Burnus <burnus@net-b.de> + + * expr.c (scalarize_intrinsic_call): Plug memory leak. + * frontend-passes.c (gcc_assert): Extend assert. + * interface.c (gfc_compare_derived_types): Fix comparison. + (gfc_check_operator_interface): Move up to make this error + message reachable. + (get_sym_storage_size): Remove always-true checks. + * io.c (format_lex): Add comment. + (gfc_free_wait): Free memory. + * match.c (gfc_match_select_type): Ditto. + * matchexpr.c (match_level_3): Ditto. + * primary.c (match_string_constant): Ditto. + (match_actual_arg): Check return value. + * resolve.c (gfc_resolve_substring_charlen, + resolve_typebound_generic_call, resolve_typebound_function, + resolve_typebound_subroutine): Free memory. + * trans-types.c (gfc_get_derived_type): Remove always-true check. + +2012-10-02 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54778 + * interface.c (matching_typebound_op): Check for 'class_ok' attribute. + +2012-09-30 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54667 + * intrinsic.texi (C_F_POINTER): Fix description. + * resolve.c (gfc_iso_c_sub_interface): Add a check for FPTR argument + of C_F_POINTER. Modify two error messages. Cleanup. + +2012-09-24 Tobias Burnus <burnus@net-b.de> + + PR fortran/54618 + PR fortran/54690 + * trans-expr.c (gfc_conv_procedure_call): Fix INTENT(OUT) + handling for allocatable BT_CLASS. + +2012-09-24 Lawrence Crowl <crowl@google.com> + + * trans-expr.c (gfc_conv_cst_int_power): Change to new double_int API. + * target-memory.c (gfc_interpret_logical): Likewise. + +2012-09-23 Tobias Burnus <burnus@net-b.de> + + * parse.c (parse_derived): Don't set attr.alloc_comp + for pointer components with allocatable subcomps. + + PR fortran/54599 + * resolve.c (resolve_fl_namelist): Remove superfluous + NULL check. + * simplify.c (simplify_min_max): Remove unreachable code. + * trans-array.c (gfc_trans_create_temp_array): Change + a condition into an assert. + + PR fortran/54618 + * trans-expr.c (gfc_trans_class_init_assign): Guard + re-setting of the _data by gfc_conv_expr_present. + (gfc_conv_procedure_call): Fix INTENT(OUT) handling + for allocatable BT_CLASS. + +2012-09-22 Thomas König <tkoenig@gcc.gnu.org> + + PR fortran/54599 + * dependency.c (gfc_dep_compare_expr): Clarify logic, + remove dead code. + +2012-09-20 Tobias Burnus <burnus@net-b.de> + + PR fortran/54599 + * cpp.c (print_line): Properly handle extern C. + +2012-09-20 Martin Jambor <mjambor@suse.cz> + + * trans-decl.c (gfc_get_extern_function_decl): Push NULL cfun. Do not + set and restore current_function_decl. + (gfc_init_coarray_decl): Do not set and restore current_function_decl. + +2012-09-17 Tobias Burnus <burnus@net-b.de> + + PR fortran/54608 + * simplify.c (gfc_simplify_scan, gfc_simplify_verify): + Fix handling of BACK=variable. + +2012-09-17 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54285 + * expr.c (gfc_check_pointer_assign): Correctly handle procedure pointers + as function results. + * primary.c (gfc_match_varspec): Allow to call a PPC with proc-ptr + result. + +2012-09-17 Tobias Burnus <burnus@net-b.de> + + PR fortran/54603 + * trans-expr.c (gfc_trans_subcomponent_assign): Handle + proc-pointer components. + +2012-09-17 Tobias Burnus <burnus@net-b.de> + + PR fortran/54599 + * error.c (error_print): Move increment out of the assert. + * interface.c (gfc_compare_derived_types): Add assert. + (get_expr_storage_size): Remove always-true logical condition. + * resolve.c (resolve_allocate_expr): Fix looping logic. + * target-memory.c (gfc_target_expr_size): Add assert. + +2012-09-16 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54594 + * resolve.c (get_checked_tb_operator_target): Add a reference to the + relevant quote from the F08 standard. + +2012-09-16 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54594 + * interface.c (compare_type_rank): Handle CLASS arrays. + +2012-09-16 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54387 + * expr.c (gfc_check_pointer_assign): Check for result of embracing + function. + +2012-09-16 Tobias Burnus <burnus@net-b.de> + + * trans-decl.c (gfc_generate_function_code): Fix + gfc_option.coarray check. + * trans-stmt.c (compute_inner_temp_size): Fix handling + of gfc_option.rtcheck. + +2012-09-16 Mikael Morin <mikael@gcc.gnu.org> + + * symbol.c (gfc_undo_symbols): Correctly undo namelists. + +2012-09-15 Tobias Burnus <burnus@net-b.de> + + * trans-io.c (gfc_trans_transfer): Add an assert. + +2012-09-15 Tobias Burnus <burnus@net-b.de> + + * arith.c (arith_power): Call gfc_free_expr in case of error. + * array.c (gfc_match_array_constructor): Initialize variable. + (gfc_resolve_character_array_constructor): Remove superfluous check. + (gfc_array_dimen_size): Add assert. + * check.c (numeric_check): Fix implicit typing. + * class.c (gfc_build_class_symbol): Add assert. + (finalize_component): Free memory. + * dump-parse-tree.c (show_namespace): Add assert. + * trans-io.c (transfer_namelist_element, transfer_expr): Avoid + memory leakage. + (gfc_trans_transfer): Add assert. + * trans.c (gfc_trans_runtime_check): Call va_end + +2012-09-15 Tobias Burnus <burnus@net-b.de> + + * match.c (lock_unlock_statement, sync_statement): Fix potential + double freeing. + (sync_statement): Remove unreachable code. + * simplify.c (gfc_simplify_bessel_n2): Avoid double freeing. + (gfc_simplify_repeat): Remove bogus code. + * target-memory.h (gfc_target_encode_expr): Update prototype. + * target-memory.c (gfc_target_encode_expr, encode_array, + encode_derived): Return unsigned HOST_WIDE_INT. + (gfc_target_interpret_expr): Add assert. + (gfc_merge_initializers): Fix "== 0" check for mpz_t. + * symbol.c (gfc_get_typebound_proc): Add assert. + (gfc_merge_initializers): Remove unreachable check. + +2012-09-13 Tobias Burnus <burnus@net-b.de> + + PR fortran/54556 + * resolve.c (resolve_formal_arglist): Allow VALUE arguments + with implicit_pure. + (gfc_impure_variable): Don't check gfc_pure such that the + function also works for gfc_implicit_pure procedures. + +2012-09-12 Tobias Burnus <burnus@net-b.de> + + PR fortran/54225 + PR fortran/53306 + * array.c (match_subscript, gfc_match_array_ref): Fix + diagnostic of coarray's '*'. + +2012-09-07 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/54208 + * simplify.c (simplify_bound_dim): Resolve array spec before + proceeding with simplification. + +2012-09-06 Tobias Burnus <burnus@net-b.de> + + PR fortran/54463 + * trans-intrinsic.c (gfc_conv_intrinsic_funcall): Fix matmul + call to BLAS if the default-kind has been promoted. + +2012-09-05 Tobias Burnus <burnus@net-b.de> + + PR fortran/54462 + * symbol.c (gfc_undo_symbols): Avoid NULL pointer dereference. + +2012-09-04 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54435 + PR fortran/54443 + * match.c (gfc_match_select_type): Make sure to only access CLASS_DATA + for BT_CLASS. + +2012-09-03 Tobias Burnus <burnus@net-b.de> + + PR fortran/54467 + * class.c (gfc_find_derived_vtab): Fix disabling of _final + by continuing to generate normal type-bound procedures. + +2012-09-03 Tobias Burnus <burnus@net-b.de> + + * class.c (gfc_find_derived_vtab): Disable ABI-breaking + generation of the "_final" subroutine for now. + +2012-09-03 Tobias Burnus <burnus@net-b.de> + + * class.c (finalize_component): Fixes to the comment. + +2012-09-03 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> + Tobias Burnus <burnus@net-b.de> + + PR fortran/37336 + * gfortran.h (symbol_attribute): Add artificial. + * module.c (mio_symbol_attribute): Handle attr.artificial + * class.c (gfc_build_class_symbol): Defer creation of the vtab + if the DT has finalizers, mark generated symbols as + attr.artificial. + (has_finalizer_component, finalize_component, + finalization_scalarizer, generate_finalization_wrapper): + New static functions. + (gfc_find_derived_vtab): Add _final component and call + generate_finalization_wrapper. + * dump-parse-tree.c (show_f2k_derived): Use resolved + proc_tree->n.sym rather than unresolved proc_sym. + (show_attr): Handle attr.artificial. + * resolve.c (gfc_resolve_finalizers): Ensure that the vtab exists. + (resolve_fl_derived): Resolve finalizers before + generating the vtab. + (resolve_symbol): Also allow assumed-rank arrays with CONTIGUOUS; + skip artificial symbols. + (resolve_fl_derived0): Skip artificial symbols. + +2012-09-02 Tobias Burnus <burnus@net-b.de> + + PR fortran/54426 + * symbol.c (find_common_symtree): New function. + (gfc_undo_symbols): Use it; free common_head if needed. + +2012-08-28 Tobias Burnus <burnus@net-b.de> + + PR fortran/54389 + * trans-decl.c (gfc_get_extern_function_decl, + build_function_decl): Don't mark impure elemental + functions as DECL_PURE_P and honour implicit_pure. + +2012-08-28 Tobias Burnus <burnus@net-b.de> + + PR fortran/54382 + * error.c (show_locus): Avoid out of bound access. + +2012-08-28 Tobias Burnus <burnus@net-b.de> + + PR fortran/54384 + * decl.c (match_data_constant): Add missing gfc_free_expr. + (top_val_list): Remove always-true condition. + * data.c (get_array_index, create_character_initializer): + Free temporary expressions. + (gfc_assign_data_value): Free expression when aborting. + +2012-08-28 Tobias Burnus <burnus@net-b.de> + + PR fortran/54384 + * symbol.c (gfc_copy_formal_args): Set also sym->formal_ns. + +2012-08-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/54384 + * resolve.c (gfc_resolve_character_operator): Free temporary + variables. + * trans-expr.c (gfc_conv_statement_function): Ditto. + +2012-08-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/54384 + * dependency.c (check_section_vs_section): Use gfc_free_expr + instead of free. + * trans-intrinsic.c (conv_generic_with_optional_char_arg): Use + gfc_free_symbol instead of free. + +2012-08-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/54384 + * trans-expr.c (gfc_trans_arrayfunc_assign): Free se.ss + and loop. + +2012-08-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/41093 + * gfortran.h (gfc_common_head): Add "int refs". + * match.c (gfc_match_common): Increment refs. + * resolve.c (resolve_symbol): Only increment formal_ns->refs + if formal_ns is not sym->ns. + * symbol.c (gfc_free_symbol): Only free formal_ns if + if formal_ns is not sym->ns. Free common_block if refs is one. + (gfc_release_symbol): Release formal_ns only if the + symbol is not ENTRY of a module. + * decl.c (get_proc_name): Don't increment gfc_current_ns->refs. + * parse.c (parse_interface): Incement proc_unit->refs++ for + proc-pointer result variables. + * module.c (mio_symbol): Don't increase sym->refs for its + use in sym->formal_ns->proc_name. + +2012-08-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/54370 + * trans-stmt.c (gfc_trans_do_while): Don't change the logical + kind for negation of the condition. + +2012-08-27 Tobias Burnus <burnus@net-b.de> + + * options.c (set_Wall): Don't set for -Wcompare-reals. + * invoke.texi (-Wall, -Wcompare-reals): -Wall no longer + implies -Wcompare-reals. + +2012-08-24 Simon Baldwin <simonb@google.com> + + * lang.opt (-cpp=): Mark flag NoDWARFRecord. + +2012-08-23 Tobias Burnus <burnus@net-b.de> + + PR fortran/54350 + * trans-array.c (free_ss_info): Free data.array.subscript. + (gfc_free_ss): No longer free data.array.subscript. + (walk_coarray): New function, moved from trans-intrinsic.c + (gfc_conv_expr_descriptor): Walk array descriptor instead + of taking passed "ss". + (get_array_ctor_all_strlen, gfc_add_loop_ss_code, + gfc_conv_array_parameter): Update call and cleanup ss handling. + * trans-array.h (gfc_conv_expr_descriptor, + gfc_conv_array_parameter): Update prototype. + * trans-expr.c (gfc_conv_derived_to_class, + conv_isocbinding_procedure, gfc_conv_procedure_call, + gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign, + gfc_trans_pointer_assignment, gfc_trans_arrayfunc_assign): Update + call to gfc_conv_expr_descriptor and gfc_conv_array_parameter, and + clean up. + * trans-intrinsic.c (walk_coarray): Moved to trans-array.c + (trans_this_image, trans_image_index, gfc_conv_intrinsic_rank + gfc_conv_intrinsic_bound, gfc_conv_intrinsic_cobound, + gfc_conv_intrinsic_len, gfc_conv_intrinsic_size, + gfc_conv_intrinsic_sizeof, gfc_conv_intrinsic_storage_size, + gfc_conv_intrinsic_transfer, gfc_conv_allocated, + gfc_conv_associated, gfc_conv_intrinsic_loc, + conv_intrinsic_move_alloc): Update calls. + * trans-io.c (gfc_convert_array_to_string, set_internal_unit, + gfc_trans_transfer): Ditto. + * trans-stmt.c (gfc_conv_elemental_dependencies, + gfc_trans_sync, trans_associate_var, + gfc_trans_pointer_assign_need_temp): Ditto. + +2012-08-23 Jakub Jelinek <jakub@redhat.com> + + * trans-decl.c (trans_function_start, generate_coarray_init, + create_main_function, gfc_generate_constructors): Call + allocate_struct_function instead of init_function_start. + +2012-08-22 Tobias Burnus <burnus@net-b.de> + + * trans-expr.c (gfc_copy_class_to_class, + gfc_trans_arrayfunc_assign): Free loop and ss data. + * trans-intrinsic.c (gfc_trans_arrayfunc_assign): Free ss data. + +2012-08-21 Tobias Burnus <burnus@net-b.de> + + * parse.c (parse_contained): Include EXEC_END_PROCEDURE + in ns->code to make sure the gfc_code is freed. + +2012-08-20 Tobias Burnus <burnus@net-b.de> + + PR fortran/54301 + * expr.c (gfc_check_pointer_assign): Warn when a pointer, + which is a function result, might outlive its target. + +2012-08-20 Tobias Burnus <burnus@net-b.de> + + PR fortran/54301 + * expr.c (gfc_check_pointer_assign): Warn when the pointer + might outlive its target. + * gfortran.h (struct gfc_option_t): Add warn_target_lifetime. + * options.c (gfc_init_options, set_wall, gfc_handle_option): + handle it. + * invoke.texi (-Wtarget-lifetime): Document it. + (-Wall): Implied it. + * lang.opt (-Wtarget-lifetime): New flag. + +2012-08-19 Thomas König <tkoenig@gcc.gnu.org> + + PR fortran/54298 + * gfortran.h (struct gfc_option_t): Add warn_compare_reals. + * lang.opt: Add Wcompare-reals. + * invoke.texi: Document -Wcompare-reals. + * resolve.c (resolve_operator): If -Wcompare-reals is in effect, + warn about equality/inequality comparisions for REAL and COMPLEX. + * options.c (gfc_init_options): Set warn_compare_reals. + (set_Wall): Include warn_compare_reals in Wall. + (gfc_handle_option): Handle Wcompare_reals. + +2012-08-17 Jakub Jelinek <jakub@redhat.com> + + * array.c (gfc_match_array_ref): Fix up memset arguments. + +2012-08-16 Diego Novillo <dnovillo@google.com> + + Revert + + PR bootstrap/54281 + * gfortran.h: Do not include gmp.h. + +2012-08-16 Diego Novillo <dnovillo@google.com> + + PR bootstrap/54281 + * gfortran.h: Do not include gmp.h. + +2012-08-15 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54243 + PR fortran/54244 + * resolve.c (check_typebound_baseobject): Check for class_ok attribute. + (resolve_procedure_interface,resolve_fl_derived0): Copy class_ok + attribute. + +2012-08-14 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/47586 + * trans-expr.c (expr_is_variable): Handle regular, procedure pointer, + and typebound functions returning a data pointer. + +2012-08-14 Mikael Morin <mikael@gcc.gnu.org> + + * decl.c (match_ppc_decl): Copy the procedure interface's symbol + as procedure interface's result. + +2012-08-14 Mikael Morin <mikael@gcc.gnu.org> + + * trans-expr.c (gfc_trans_scalar_assign): Rename argument, + extend comment. + +2012-08-14 Mikael Morin <mikael@gcc.gnu.org> + + * gfortran.h (gfc_get_proc_ptr_comp): New prototype. + (gfc_is_proc_ptr_comp): Update prototype. + * expr.c (gfc_get_proc_ptr_comp): New function based on the old + gfc_is_proc_ptr_comp. + (gfc_is_proc_ptr_comp): Call gfc_get_proc_ptr_comp. + (gfc_specification_expr, gfc_check_pointer_assign): Use + gfc_get_proc_ptr_comp. + * trans-array.c (gfc_walk_function_expr): Likewise. + * resolve.c (resolve_structure_cons, update_ppc_arglist, + resolve_ppc_call, resolve_expr_ppc): Likewise. + (resolve_function): Update call to gfc_is_proc_ptr_comp. + * dump-parse-tree.c (show_expr): Likewise. + * interface.c (compare_actual_formal): Likewise. + * match.c (gfc_match_pointer_assignment): Likewise. + * primary.c (gfc_match_varspec): Likewise. + * trans-io.c (gfc_trans_transfer): Likewise. + * trans-expr.c (gfc_conv_variable, conv_function_val, + conv_isocbinding_procedure, gfc_conv_procedure_call, + gfc_trans_pointer_assignment): Likewise. + (gfc_conv_procedure_call, gfc_trans_array_func_assign): + Use gfc_get_proc_ptr_comp. + +2012-08-14 Tobias Burnus <burnus@net-b.de> + + PR fortran/40881 + * error.c (gfc_notify_std): Reset cur_error_buffer->flag flag + when the error/warning has been printed. + * gfortran.h (gfc_sl_type): Add ST_LABEL_DO_TARGET. + * match.c (gfc_match_do): Use ST_LABEL_DO_TARGET. + * parse.c (check_statement_label): Use ST_LABEL_DO_TARGET. + (parse_executable): Add obsolescence check for DATA. + * resolve.c (resolve_branch): Handle ST_LABEL_DO_TARGET. + * symbol.c (gfc_define_st_label, gfc_reference_st_label): + Add obsolescence diagnostics. + * trans-stmt.c (gfc_trans_label_assign): Handle ST_LABEL_DO_TARGET. + +2012-08-14 Tobias Burnus <burnus@net-b.de> + + PR fortran/54234 + * check.c (gfc_check_cmplx): Add -Wconversion warning + when converting higher-precision REAL to default-precision + CMPLX without kind= parameter. + +2012-08-12 Tobias Burnus <burnus@net-b.de> + + PR fortran/54221 + * trans-decl.c (gfc_finish_var_decl, build_function_decl): + Fix setting private module vars/procs as TREE_PUBLIC(...) = 0. + +2012-08-09 Tobias Burnus <burnus@net-b.de> + + PR fortran/54199 + * intrinsic.c (gfc_warn_intrinsic_shadow): Better warning + for internal procedures. + +2012-08-06 Janus Weil <janus@gcc.gnu.org> + + PR fortran/35831 + * interface.c (check_result_characteristics): New function, which checks + the characteristics of function results. + (gfc_compare_interfaces,gfc_check_typebound_override): Call it. + +2012-08-02 Thomas König <tkoenig@gcc.gnu.org> + + PR fortran/54033 + * scanner.c (add_path_to_list): New argument warn. Don't + warn if it is true. + (gfc_add_include_path): Warn if directory is missing. + (gfc_add_intrinsic_modules_path): Do not warn if directory + is missing. + * optinons.c (gfc_handle_option): Do not add directory + for intrinsic modules to normal include path. + +2012-08-03 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/54166 + * trans-array.c (set_loop_bounds): Access specinfo using spec_dim. + +2012-08-02 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/48820 + * trans-array.c (gfc_conv_ss_startstride): Set the intrinsic + result's lower and upper bounds according to the rank. + (set_loop_bounds): Set the loop upper bound in the intrinsic case. + +2012-08-02 Mikael Morin <mikael@gcc.gnu.org> + + * trans-array.c (set_loop_bounds): Allow non-array-section to be + chosen using the stride and lower bound criteria. + +2012-08-02 Mikael Morin <mikael@gcc.gnu.org> + + * trans-array.c (set_loop_bounds): Remove useless dimension check. + Don't update loopspec if it would loose the wanted stride criterion. + +2012-08-02 Mikael Morin <mikael@gcc.gnu.org> + + * trans-array.h (gfc_conv_descriptor_rank): New prototype. + * trans-array.c (gfc_conv_descriptor_rank): New function moved and + renamed ... + * trans-intrinsic.c (get_rank_from_desc): ... from this one. + (gfc_conv_intrinsic_rank, gfc_conv_intrinsic_bound, + gfc_conv_associated): Also rename function calls. + +2012-08-02 Mikael Morin <mikael@gcc.gnu.org> + + * iresolve.c (resolve_bound, gfc_resolve_shape): + Don't set the shape for assumed rank arrays. + * simplify.c (gfc_simplify_shape): Don't try to simplify if the + argument is assumed rank. + +2012-08-02 Mikael Morin <mikael@gcc.gnu.org> + + * array.c (gfc_copy_array_ref): Don't copy the offset field. + * expr.c (find_array_section): Ignore the offset field. + * trans-expr.c (gfc_find_interface_mapping_to_ref): Don't apply + any interface mapping to the offset field. + * gfortran.h (struct gfc_array_ref): Remove the offset field. + +2012-08-02 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54147 + * resolve.c (check_proc_interface): New routine for PROCEDURE interface + checks. + (resolve_procedure_interface,resolve_typebound_procedure, + resolve_fl_derived0): Call it. + +2012-08-01 Thomas König <tkoenig@gcc.gnu.org> + + PR fortran/54033 + * scanner.c (add_path_to_list): Emit warning if an error occurs + for an include path, if it is not present or if it is not a + directory. Do not add the path in these cases. + +2012-07-31 Janus Weil <janus@gcc.gnu.org> + + PR fortran/42418 + * decl.c (match_procedure_interface): Move some checks to + 'resolve_procedure_interface'. Set flavor if appropriate. + * expr.c (gfc_check_pointer_assign): Cleanup of 'gfc_is_intrinsic'. + * intrinsic.c (gfc_is_intrinsic): Additional checks for attributes which + identify a procedure as being non-intrinsic. + * resolve.c (resolve_procedure_interface): Checks moved here from + 'match_procedure_interface'. Minor cleanup. + (resolve_formal_arglist,resolve_symbol): Cleanup of + 'resolve_procedure_interface' + (resolve_actual_arglist,is_external_proc): Cleanup of + 'gfc_is_intrinsic'. + +2012-07-31 Janus Weil <janus@gcc.gnu.org> + + PR fortran/54134 + * dependency.c (gfc_dep_compare_expr): Check if arguments are NULL. + +2012-07-31 Tobias Burnus <burnus@net-b.de> + + * interface.c (gfc_procedure_use): Return gfc_try instead of void. + * gfortran.h (gfc_procedure_use): Update prototype. + * resolve.c (gfc_iso_c_func_interface): Allow noninteroperable + procedures for c_funloc for TS29113. + * (gfc_iso_c_sub_interface): Ditto for c_f_procpointer. Add + diagnostic for c_ptr vs. c_funptr for c_f_(proc)pointer. + +2012-07-30 Janus Weil <janus@gcc.gnu.org> + + PR fortran/51081 + * gfortran.h (gfc_resolve_intrinsic): Add prototype. + * expr.c (gfc_check_pointer_assign): Set INTRINSIC attribute if needed. + Check for invalid intrinsics. + * primary.c (gfc_match_rvalue): Check for intrinsics came too early. + Set procedure flavor if appropriate. + * resolve.c (resolve_intrinsic): Renamed to gfc_resolve_intrinsic. + (resolve_procedure_interface,resolve_procedure_expression, + resolve_function,resolve_fl_derived0,resolve_symbol): Ditto. + +2012-07-26 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/44354 + * trans-array.c (gfc_trans_array_constructor_value): + Evaluate the iteration bounds before the inner variable shadows + the outer. + +2012-07-26 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/44354 + * array.c (sought_symbol): New variable. + (expr_is_sought_symbol_ref, find_symbol_in_expr): New functions. + (resolve_array_list): Check for references to the induction + variable in the iteration bounds and issue a diagnostic if some + are found. + +2012-07-26 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> + Tobias Burnus <burnus@net-b.de> + + * module.c (mio_array_spec): Don't read as->lower for + assumed-rank arrays. + +2012-07-25 Tobias Burnus <burnus@net-b.de> + + * trans-types.c (gfc_real16_is_float128): Fix spelling + in a comment. + * trans.h (struct gfc_array_info): Ditto. + * gfortran.h (gfc_expr): Ditto. + * simplify.c (gfc_count): Ditto. + * trans-expr.c (gfc_copy_class_to_class, + conv_parent_component_references, + gfc_trans_pointer_assignment): Ditto. + * expr.c (check_pointer_assign): Fix diagnostic spelling. + * interface.c (compare_parameter): Ditto. + * parse.c (use_modules, parse_associate): Ditto. + * decl.c (match_char_length): Fix spelling of the + an function argument. + +2012-07-21 Tobias Burnus <burnus@net-b.de> + + * iso-c-binding.def (C_PTRDIFF_T): New TS29113 parameter. + * intrinsic.texi (ISO_C_BINDING): Document it. + +2012-07-21 Tobias Burnus <burnus@net-b.de> + + PR fortran/48820 + * trans-intrinsic.c (gfc_conv_intrinsic_bound): Support + lbound/ubound with dim= for assumed-rank arrays. + * array.c (gfc_set_array_spec): Reject coarrays with + assumed shape. + * decl.c (merge_array_spec): Ditto. Return gfc_try. + (match_attr_spec, match_attr_spec): Update call. + +2012-07-21 Tobias Burnus <burnus@net-b.de> + + * resolve.c (resolve_formal_arglist): Put variable + declaration before the first assignment. + +2012-07-21 Tobias Burnus <burnus@net-b.de> + + * trans-expr.c (gfc_conv_derived_to_class): Fix argument passed + to class_array_data_assign. + +2012-07-20 Tobias Burnus <burnus@net-b.de> + + * decl.c (gfc_verify_c_interop_param): Allow assumed-shape + with -std=f2008ts. + +2012-07-20 Tobias Burnus <burnus@net-b.de> + + PR fortran/48820 + * array.c (match_array_element_spec, gfc_match_array_spec, + spec_size, gfc_array_dimen_size): Add support for + assumed-rank arrays. + * check.c (dim_rank_check): Ditto. + * class.c (gfc_add_component_ref): Ditto. + (gfc_build_class_symbol): Regard assumed-rank arrays + as having GFC_MAX_DIMENSIONS. And build extra class + container for a scalar pointer class. + * decl.c (merge_array_spec): Add assert. + * dump-parse-tree.c (show_array_spec): Add support for + assumed-rank arrays. + * expr.c (gfc_is_simply_contiguous): Ditto. + * gfortran.h (array_type): Ditto. + (gfc_array_spec, gfc_expr): Add comment to "rank" field. + * interface.c (compare_type_rank, argument_rank_mismatch, + compare_parameter, gfc_procedure_use): Ditto. + (compare_actual_formal): Fix NULL() to optional-dummy + handling for polymorphic dummies. + * module.c (mio_typespec): Add support for + assumed-rank arrays. + * resolve.c (resolve_formal_arglist, resolve_actual_arglist, + resolve_elemental_actual, resolve_global_procedure, + expression_shape, resolve_variable, update_ppc_arglist, + check_typebound_baseobject, gfc_resolve_expr, + resolve_fl_var_and_proc, gfc_resolve_finalizers, + resolve_typebound_procedure, resolve_symbol): Ditto. + (assumed_type_expr_allowed): Remove static variable. + (actual_arg, first_actual_arg): New static variables. + * simplify.c (simplify_bound, gfc_simplify_range): Add + support for assumed-rank arrays. + * trans-array.c (gfc_conv_array_parameter): Ditto. + (gfc_get_descriptor_dimension): New function, which returns + the descriptor. + (gfc_conv_descriptor_dimension): Use it. + (gfc_conv_descriptor_stride_get, gfc_conv_array_parameter): + Handle GFC_ARRAY_ASSUMED_RANK_CONT and AS_ASSUMED_RANK. + * trans-array.h (gfc_get_descriptor_dimension): New prototype. + * trans-decl. (gfc_build_dummy_array_decl, + gfc_trans_deferred_vars, add_argument_checking): Add + support for assumed-rank arrays. + * trans-expr.c (gfc_conv_expr_present, gfc_conv_variable, + gfc_conv_procedure_call): Ditto. + (get_scalar_to_descriptor_type, class_array_data_assign, + conv_scalar_to_descriptor): New static functions. + (gfc_conv_derived_to_class, gfc_conv_class_to_class): Use + them. + * trans-intrinsic.c (get_rank_from_desc): New function. + (gfc_conv_intrinsic_rank, gfc_conv_associated): Use it. + * trans-types.c (gfc_array_descriptor_base_caf, + gfc_array_descriptor_base): Make space for scalar array. + (gfc_is_nodesc_array, gfc_is_nodesc_array, + gfc_build_array_type, gfc_get_array_descriptor_base): Add + support for assumed-rank arrays. + * trans.h (gfc_array_kind): Add GFC_ARRAY_ASSUMED_RANK and + GFC_ARRAY_ASSUMED_RANK_CONT. + +2012-07-19 Tobias Burnus <burnus@net-b.de> + + * trans-expr.c (gfc_conv_procedure_call): Fix handling + of polymorphic arguments. + * resolve.c (resolve_formal_arglist): Ditto, mark polymorphic + assumed-shape arrays as such. + +2012-07-19 Tobias Burnus <burnus@net-b.de> + + * interface.c (compare_parameter, compare_actual_formal): Fix + handling of polymorphic arguments. + +2012-07-17 Janus Weil <janus@gcc.gnu.org> + + PR fortran/51081 + * error.c (gfc_notify_std): Automatically print the relevant Fortran + standard version. + * arith.c (arith_power): Remove explicit standard reference string. + * array.c (gfc_match_array_spec, gfc_match_array_constructor): Ditto. + * check.c (gfc_check_a_p, gfc_check_besn, gfc_check_count, + gfc_check_float, gfc_check_fn_rc2008, gfc_check_iand, + gfc_check_ichar_iachar, gfc_check_ieor, gfc_check_index, gfc_check_ior, + gfc_check_lbound, gfc_check_len_lentrim, check_rest, gfc_check_min_max, + gfc_check_null, gfc_check_scan, gfc_check_selected_real_kind, + gfc_check_shape, gfc_check_size, gfc_check_sngl, gfc_check_ubound, + gfc_check_verify): Ditto. + * data.c (gfc_assign_data_value): Ditto. + * decl.c (var_element, char_len_param_value, match_char_length, + gfc_verify_c_interop_param, match_pointer_init, variable_decl, + gfc_match_decl_type_spec, gfc_match_import, match_attr_spec, + gfc_match_prefix, gfc_match_suffix, match_ppc_decl, + match_procedure_in_interface, gfc_match_procedure,gfc_match_entry, + gfc_match_subroutine, gfc_match_end, gfc_match_codimension, + gfc_match_protected, gfc_match_value, gfc_match_volatile, + gfc_match_asynchronous, gfc_match_modproc, gfc_get_type_attr_spec, + gfc_match_enum, match_procedure_in_type): Ditto. + * expr.c (check_elemental, gfc_check_assign, gfc_check_pointer_assign): + Ditto. + * interface.c (gfc_match_abstract_interface, check_interface0): Ditto. + * intrinsic.c (gfc_intrinsic_func_interface): Ditto. + * io.c (format_lex, resolve_tag_format, resolve_tag, + compare_to_allowed_values, gfc_match_open, gfc_match_rewind, + gfc_resolve_dt, gfc_match_wait): Ditto. + * match.c (match_arithmetic_if, gfc_match_if, gfc_match_critical, + gfc_match_do, match_exit_cycle, gfc_match_pause, gfc_match_stop, + gfc_match_lock, sync_statement, gfc_match_assign, gfc_match_goto, + gfc_match_allocate, gfc_match_return, gfc_match_st_function): Ditto. + * module.c (gfc_match_use, gfc_use_module): Ditto. + * parse.c (parse_derived_contains, parse_block_construct, + parse_associate, parse_contained): Ditto. + * primary.c (match_hollerith_constant, match_boz_constant, + match_real_constant, match_sym_complex_part, match_arg_list_function, + build_actual_constructor, gfc_convert_to_structure_constructor): Ditto. + * resolve.c (resolve_formal_arglist, resolve_entries, + resolve_common_blocks, resolve_actual_arglist, gfc_resolve_index_1, + gfc_resolve_iterator_expr, resolve_ordinary_assign, + resolve_fl_var_and_proc, resolve_fl_variable_derived, + resolve_fl_procedure, resolve_fl_derived0, resolve_fl_derived, + resolve_fl_namelist, resolve_symbol, resolve_fntype): Ditto. + * symbol.c (check_conflict, conflict, gfc_add_is_bind_c, + gfc_add_extension, gfc_check_symbol_typed): Ditto. + +2012-07-17 Tobias Burnus <burnus@net-b.de> + + PR fortran/53985 + * decl.c (gfc_verify_c_interop_param): Make warning conditional + on -Wc-binding-type works and improve the wording. + +2012-07-17 Tobias Burnus <burnus@net-b.de> + + PR fortran/52101 + * decl.c (match_char_length): Extra argument, show obsolenscent + warning only if *length is used after the typename. + (variable_decl, gfc_match_char_spec): Update call + +2012-07-17 Tobias Burnus <burnus@net-b.de> + Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/49265 + * decl.c (match_procedure_in_interface): Support "::" for + Fortran 2008 and later. + +2012-07-16 Thomas König <tkoenig@gcc.gnu.org> + + PR fortran/53824 + * resolve.c (resolve_allocate_deallocate): If both + start indices are NULL, skip the test for equality. + +2012-07-16 Steven Bosscher <steven@gcc.gnu.org> + + * f95-lang.c: Include dumpfile.h instead of tree-dump.h. + * Make-lang.in: Fix dependencies. + +2012-07-16 Janus Weil <janus@gcc.gnu.org> + + PR fortran/53956 + * gfortran.h (gfc_copy_formal_args,gfc_copy_formal_args_ppc): Modified + prototypes. + * symbol.c (gfc_copy_formal_args): New argument 'if_src'. Copy if_source + of dummy procedures. + (gfc_copy_formal_args_ppc): Ditto. + * resolve.c (resolve_procedure_interface): Pass IFSRC_DECL to + gfc_copy_formal_args. + (resolve_fl_derived0): Pass IFSRC_DECL to gfc_copy_formal_args_ppc. + +2012-07-12 Tobias Burnus <burnus@net-b.de> + + * trans-expr.c (conv_isocbinding_procedure): Generate c_f_pointer code + inline. + +2012-07-11 Steven Bosscher <steven@gcc.gnu.org> + + * trans.c: Do not include defaults.h. + * trans-intrinsic.c: Likewise. + +2012-07-08 Steven Bosscher <steven@gcc.gnu.org> + + * gfortran.h: Do not include coretypes.h here. + Make it an error to include this before coretypes.h + * openmp.c: Include coretypes.h. + * interface.c: Likewise. + * intrinsic.c: Likewise. + * symbol.c: Likewise. + * class.c: Likewise. + * decl.c: Likewise. + * matchexp.c: Likewise. + * dump-parse-tree.c: Likewise. + * array.c: Likewise. + * constructor.c: Likewise. + * error.c: Likewise. + * data.c: Likewise. + * expr.c: Likewise. + * module.c: Likewise. + * scanner.c: Likewise. + * bbt.c: Likewise. + * io.c: Likewise. + * frontend-passes.c: Likewise. + * resolve.c: Likewise. + * st.c: Likewise. + * target-memory.c: Likewise. + * match.c: Likewise. + * arith.c: Likewise. + * parse.c: Likewise. + * check.c: Likewise. + * dependency.c: Likewise. + * primary.c: Likewise. + * misc.c: Likewise. + * simplify.c: Likewise. + +2012-07-05 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/53732 + * trans-array.c (gfc_add_loop_ss_code): Disable self recursive calls + handling nested loop(s) if the subscript flag is true. + +2012-07-05 Uros Bizjak <ubizjak@gmail.com> + + PR fortran/53449 + * parse.c (gfc_parse_file): Initialize errors_before. + +2012-06-27 Janus Weil <janus@gcc.gnu.org> + + PR fortran/41951 + PR fortran/49591 + * interface.c (check_new_interface): Rename, add 'loc' argument, + make non-static. + (gfc_add_interface): Rename 'check_new_interface' + * gfortran.h (gfc_check_new_interface): Add prototype. + * resolve.c (resolve_typebound_intrinsic_op): Add typebound operator + targets to non-typebound operator list. + +2012-06-22 Janus Weil <janus@gcc.gnu.org> + + PR fortran/47710 + PR fortran/53328 + * interface.c (count_types_test, generic_correspondence, + gfc_compare_interfaces): Ignore PASS arguments. + (check_interface1, compare_parameter): Pass NULL arguments to + gfc_compare_interfaces. + * gfortran.h (gfc_compare_interfaces): Modified prototype. + * expr.c (gfc_check_pointer_assign): Pass NULL arguments to + gfc_compare_interfaces. + * resolve.c (resolve_structure_cons): Ditto. + (check_generic_tbp_ambiguity): Determine PASS arguments and pass them + to gfc_compare_interfaces. + +2012-06-21 Janne Blomqvist <jb@gcc.gnu.org> + + PR fortran/39654 + * iresolve.c (gfc_resolve_ftell): Fix result kind and use new + library function. + +2012-06-18 Tobias Burnus <burnus@net-b.de> + + * intrinsic.h (gfc_resolve_rank): New prototype. + * intrinsic.c (add_functions): Use gfc_resolve_rank. + * iresolve.c (add_functions): New function. + * trans-intrinsic.c (gfc_conv_intrinsic_rank): New function. + (gfc_conv_intrinsic_function): Call it. + +2012-06-18 Tobias Burnus <burnus@net-b.de> + + PR fortran/53692 + * trans-array.c (set_loop_bounds): Don't scalarize via absent + optional arrays. + * resolve.c (resolve_elemental_actual): Don't stop resolving after printing + a warning. + +2012-06-18 Tobias Burnus <burnus@net-b.de> + + PR fortran/53526 + * trans-intrinsic.c (conv_intrinsic_move_alloc): Handle coarrays. + +2012-06-18 Tobias Burnus <burnus@net-b.de> + + PR fortran/53526 + * check.c (gfc_check_move_alloc): Reject coindexed actual arguments + and those with different corank. + +2012-06-17 Tobias Burnus <burnus@net-b.de> + + PR fortran/53691 + PR fortran/53685 + * check.c (gfc_calculate_transfer_sizes): Return if + SIZE= is not constant or source-size cannot be determined. + +2012-06-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/53642 + PR fortran/45170 + * frontend-passes.c (optimize_assignment): Don't remove RHS's + trim when assigning to a deferred-length string. + * trans-expr.c (gfc_trans_assignment_1): Ensure that the RHS string + length is evaluated before the deferred-length LHS is reallocated. + +2012-06-13 Tobias Burnus <burnus@net-b.de> + + PR fortran/53643 + * trans-decl.c (init_intent_out_dt): Fix for polymorphic arrays. + * trans-array.c (structure_alloc_comps): Don't loop for + scalar coarrays. + +2012-06-13 Tobias Burnus <burnus@net-b.de> + + PR fortran/53597 + * decl.c (match_attr_spec): Only mark module variables + as SAVE_IMPLICIT for Fortran 2008 and later. + +2012-06-08 Janus Weil <janus@gcc.gnu.org> + + PR fortran/52552 + * match.c (gfc_match_allocate): Modify order of checks. Change wording + of error message. Remove FIXME note. + * resolve.c (resolve_allocate_expr): Add a comment. + +2012-06-07 Thomas König <tkoenig@gcc.gnu.org> + + PR fortran/52861 + * frontend-passes.c (optimize_assignment): Don't set the + length of an empty string for deferred-length character + variables. + +2012-06-07 Thomas König <tkoenig@gcc.gnu.org> + + PR fortran/52861 + * frontend-passes.c (empty_string): Add prototype. + (optimize_assignment): Set the length of an empty string + constant to zero. + +2012-06-04 Tobias Burnus <burnus@net-b.de> + + PR fortran/50619 + * resolve.c (build_default_init_expr): Don't initialize + ASSOCIATE names. + +2012-06-03 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> + Tobias Burnus <burnus@net-b.de> + + PR fortran/48831 + * gfortran.h (gfc_check_init_expr): Add prototype declaration + of function. + * check.c (kind_check): Change if condition to use + to gfc_check_init_expr. + * expr.c (check_init_expr): Remove forward declaration + and static keyword. Change name in gfc_check_init_expr. + (scalarize_intrinsic_call, check_init_expr_arguments, + check_inquiry, check_conversion, gfc_reduce_init_expr): Update + call to gfc_check_init_expr. + +2012-05-31 Steven Bosscher <steven@gcc.gnu.org> + + * trans-common.c: Do not include output.h. + * trans-decl.c: Likewise. + +2012-05-31 Tobias Burnus <burnus@net-b.de> + + PR fortran/53521 + * trans.c (gfc_deallocate_scalar_with_status): Properly + handle the case size == 0. + +2012-05-30 Tobias Burnus <burnus@net-b.de> + + PR c/53502 + * decl.c (match_attr_spec): Remove "typedef". + +2012-05-30 Tobias Burnus <burnus@net-b.de> + + * decl.c: Fix comment typos. + * expr.c: Ditto. + * frontend-passes.c: Ditto. + * match.c: Ditto. + * resolve.c: Ditto. + * trans-array.c: Ditto. + * trans-common.c: Ditto. + * trans-intrinsic.c: Ditto. + * trans-types.c: Ditto. + +2012-05-23 Tobias Burnus <burnus@net-b.de> + + PR fortran/51055 + PR fortran/45170 + * match.c (gfc_match_allocate): Set length_from_typespec + for characters. + * resolve.c (resolve_charlen): If set, don't check whether + the len is a specification expression. + +2012-05-22 Tobias Burnus <burnus@net-b.de> + + PR fortran/53389 + * trans-array.c (gfc_add_loop_ss_code): Don't evaluate expression, if + ss->is_alloc_lhs is set. + +2012-05-22 Dodji Seketeli <dodji@redhat.com> + + PR c++/53322 + * f95-lang.c (gfc_init_builtin_functions): Remove the unused + typedef builtin_type. + +2012-05-14 Janne Blomqvist <jb@gcc.gnu.org> + + PR fortran/52428 + * gfortran.texi: Update _gfortran_set_options documentation. + * invoke.texi: Remove runtime behavior description of + -fno-range-check. + * trans-decl.c (create_main_function): Don't pass the range-check + setting to the library. + +2012-05-14 Tobias Burnus <burnus@net-b.de> + + PR fortran/49110 + PR fortran/51055 + PR fortran/53329 + * trans-expr.c (gfc_trans_assignment_1): Fix allocation + handling for assignment of function results to allocatable + deferred-length strings. + * trans-decl.c (gfc_create_string_length): For deferred-length + module variables, include module name in the assembler name. + (gfc_get_symbol_decl): Don't override the assembler name. + +2012-05-14 Manuel López-Ibáñez <manu@gcc.gnu.org> + + PR 53063 + * options.c (gfc_handle_option): Call lang-specific generated function. + +2012-05-13 Alessandro Fanfarillo <fanfarillo.gcc@gmail.com> + Tobias Burnus <burnus@net-b.de> + + PR fortran/52158 + PR fortran/45170 + PR fortran/49430 + * resolve.c (resolve_fl_derived0): Deferred character length + procedure components are supported. + * trans-expr.c (gfc_conv_procedure_call): Handle TBP with + deferred-length results. + (gfc_string_to_single_character): Add a new check to prevent + NULL read. + (gfc_conv_procedure_call): Remove unuseful checks on + symbol's attributes. Add new checks to prevent NULL read on + string length. + +2012-05-12 Tobias Burnus <burnus@net-b.de> + + PR fortran/49110 + PR fortran/52843 + * resolve.c (resolve_fl_procedure): Don't regard + character(len=:) as character(*) in the diagnostic. + +2012-05-11 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/52537 + * frontend-passes.c (optimize_op): Change + old-style comparison operators to new-style, simplify + switch as a result. + (empty_string): New function. + (get_len_trim_call): New function. + (optimize_comparison): If comparing to an empty string, + use comparison of len_trim to zero. + Use new-style comparison operators only. + (optimize_trim): Use get_len_trim_call. + +2012-05-11 Manuel López-Ibáñez <manu@gcc.gnu.org> + + PR 53063 + * options.c: Include diagnostics.h instead of + diagnostics-core.h. + (set_Wall): Do not see warn_unused here. + (gfc_handle_option): Set it here using handle_generated_option. + +2012-05-08 Jan Hubicka <jh@suse.cz> + + * trans-common.c (create_common): Do not fake TREE_ASM_WRITTEN. + * trans-decl.c (gfc_finish_cray_pointee): Likewise. + +2012-05-07 Tobias Burnus <burnus@net-b.de> + + PR fortran/53255 + * resolve.c (resolve_typebound_static): Fix handling + of overridden specific to generic operator. + +2012-05-06 Tobias Burnus <burnus@net-b.de> + + PR fortran/41587 + * decl.c (build_struct): Don't ignore FAILED status. + +2012-05-05 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/41600 + * trans-array.c (build_array_ref): New static function. + (gfc_conv_array_ref, gfc_get_dataptr_offset): Call it. + * trans-expr.c (gfc_get_vptr_from_expr): New function. + (gfc_conv_derived_to_class): Add a new argument for a caller + supplied vptr and use it if it is not NULL. + (gfc_conv_procedure_call): Add NULL to call to above. + symbol.c (gfc_is_associate_pointer): Return true if symbol is + a class object. + * trans-stmt.c (trans_associate_var): Handle class associate- + names. + * expr.c (gfc_get_variable_expr): Supply the array-spec if + possible. + * trans-types.c (gfc_typenode_for_spec): Set GFC_CLASS_TYPE_P + for class types. + * trans.h : Add prototypes for gfc_get_vptr_from_expr and + gfc_conv_derived_to_class. Define GFC_CLASS_TYPE_P. + * resolve.c (resolve_variable): For class arrays, ensure that + the target expression has all the necessary _data references. + (resolve_assoc_var): Throw a "not yet implemented" error for + class array selectors that need a temporary. + * match.c (copy_ts_from_selector_to_associate, + select_derived_set_tmp, select_class_set_tmp): New functions. + (select_type_set_tmp): Call one of last two new functions. + (gfc_match_select_type): Copy_ts_from_selector_to_associate is + called if associate-name is typed. + + PR fortran/53191 + * resolve.c (resolve_ref): C614 applied to class expressions. + +2012-05-05 Janne Blomqvist <jb@gcc.gnu.org> + + PR fortran/49010 + PR fortran/24518 + * intrinsic.texi (MOD, MODULO): Mention sign and magnitude of result. + * simplify.c (gfc_simplify_mod): Use mpfr_fmod. + (gfc_simplify_modulo): Likewise, use copysign to fix the result if + zero. + * trans-intrinsic.c (gfc_conv_intrinsic_mod): Remove fallback as + builtin_fmod is always available. For modulo, call copysign to fix + the result when signed zeros are enabled. + +2012-05-05 Janne Blomqvist <jb@gcc.gnu.org> + + * gfortran.texi (GFORTRAN_TMPDIR): Rename to TMPDIR, explain + algorithm for choosing temp directory. + +2012-05-04 Tobias Burnus <burnus@net-b.de> + + PR fortran/53175 + * resolve.c (resolve_variable): Set public_used + if a private module variable is used in a (public) + specification expression. + * trans-decl.c (gfc_finish_var_decl): Mark those + TREE_PUBLIC. + +2012-05-04 Tobias Burnus <burnus@net-b.de> + + PR fortran/53111 + * resolve.c (resolve_fl_derived): Fix -std=f95 + diagnostic for generic vs. DT names. + +2012-05-03 Tobias Burnus <burnus@net-b.de> + + PR fortran/52864 + * interface.c (compare_parameter_intent): Remove. + (check_intents): Remove call, handle CLASS pointer. + (compare_actual_formal): Handle CLASS pointer. + +2012-04-30 Jan Hubicka <jh@suse.cz> + + * f95-lang.c (gfc_finish): Update comments. + +2012-04-29 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/53148 + * frontend-passes.c (create_var): If the statement has a label, + put the label around the block. + +2012-04-25 Tobias Burnus <burnus@net-b.de> + + PR fortran/52196 + * lang.opt (Wrealloc-lhs, Wrealloc-lhs-all): New flags. + * gfortran.h (gfc_option_t): Add them. + * options.c (gfc_init_options, gfc_post_options, + gfc_handle_option): Handle them. + * invoke.texi: Document them. + * trans-expr.c (realloc_lhs_warning): New function. + (gfc_trans_arrayfunc_assign, + alloc_scalar_allocatable_for_assignment, + gfc_trans_assignment_1): Use it. + +2012-04-18 Steven Bosscher <steven@gcc.gnu.org> + + * trans-decl.c (gfc_trans_entry_master_switch): Build SWITCH_EXPR + with NULL_TREE type instead of void_type_node. + * trans-io.c (io_result): Likewise. + * trans-stmt.c (gfc_trans_integer_select, + gfc_trans_character_select): Likewise. + +2012-04-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/52864 + * expr.c (gfc_check_vardef_context): Fix assignment check for + pointer components. + +2012-04-16 Janus Weil <janus@gcc.gnu.org> + + PR fortran/52968 + * class.c (gfc_build_class_symbol): Make sure the 'f2k_derived' + namespace is present. + +2012-04-15 Janus Weil <janus@gcc.gnu.org> + + PR fortran/51082 + * trans-expr.c (gfc_conv_expr_reference): Check if the expression is a + simple function call (or a more involved PPC reference). + +2012-04-15 Tobias Burnus <burnus@net-b.de> + + PR fortran/52916 + PR fortran/40973 + * gfortran.h (symbol_attribute): Add public_used. + * interface.c (check_sym_interfaces, check_uop_interfaces, + gfc_check_interfaces): Set it. + * resolve.c (resolve_typebound_procedure): Ditto. + * trans-decl.c (build_function_decl): Use it. + +2012-04-11 Tobias Burnus <burnus@net-b.de> + + PR fortran/52729 + * resolve.c (resolve_symbol): Fix searching for parent NS decl. + +2012-04-08 Tobias Burnus <burnus@net-b.de> + + PR fortran/52751 + * trans-decl.c (gfc_finish_var_decl): Don't set TREE_PUBLIC + for PRIVATE module variables without C-binding label. + + PR fortran/40973 + * trans-decl.c (build_function_decl): Ditto for procedures. + +2012-04-07 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/52893 + * frontend-passes.c: Keep track of wether we are in an implicit + DO loop; do not do function elimination if we are. + +2012-04-06 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/52668 + * module.c: Only mark symbols as use_only if they have been + imported via an only list. + +2012-03-28 Paul Thomas <pault@gcc.gnu.org> + Tobias Burnus <burnus@gcc.gnu.org> + + PR fortran/52652 + * match.c (gfc_match_allocate, gfc_match_deallocate): Change + "not.. or" to "neither.. nor". + * parse.c (decode_specification_statement): Correct error in + chpice of matching function for "allocatable". + +2012-03-23 Janne Blomqvist <jb@gcc.gnu.org> + + * gfortran.h (GFC_MAX_LINE): Remove unused macro. + +2012-03-19 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR fortran/52559 + * error.c (gfc_widechar_display_length): Consider tabs as + one character wide, as they're displayed as spaces. + (show_locus): Move tab handling to... + (print_wide_char_into_buffer): ... here. + +2012-03-17 Tobias Burnus <burnus@net-b.de> + + PR fortran/52585 + * trans-intrinsic.c (gfc_conv_associated): Fix handling of + procpointer dummy arguments. + +2012-03-16 Janne Blomqvist <jb@gcc.gnu.org> + + * trans-intrinsic.c (build_round_expr): Don't use BUILT_IN_IROUND + for __float128. + +2012-03-15 Janne Blomqvist <jb@gcc.gnu.org> + + * f95-lang.c (gfc_init_builtin_functions): Initialize + BUILT_IN_IROUND. + * mathbuiltins.def: Add IROUND. + * trans-intrinsic.c (build_round_expr): Use BUILT_IN_IROUND if + type size matches. + (gfc_build_intrinsic_lib_fndecls): Build iround functions. + +2012-03-12 Richard Guenther <rguenther@suse.de> + + * f95-lang.c (builtin_type_for_size): Use gfc_type_for_size. + +2012-03-12 Tobias Burnus <burnus@net-b.de> + + PR fortran/52542 + * decl.c (match_procedure_decl): If the interface + is bind(C), the procedure is as well. + +2012-03-10 Steven Bosscher <steven@gcc.gnu.org> + + * convert.c (convert): Fold BOOLEAN_TYPE types to the proper variant. + +2012-03-09 Steven Bosscher <steven@gcc.gnu.org> + + * Make-lang.in (convert.o): Depend on convert.h. + * convert.c: Header and comment cleanups. + (gfc_thruthvalue_conversion): Rename static function + to truthvalue_conversion. Do not use 'internal_error' from here, + use 'gcc_unreachable' instead. + (convert): Do not use 'error' for conversions to void, use + 'gcc_unreachable' instead. Likewise for conversions to non-scalar + types. Do not hanlde ENUMERAL_TYPE, the front end never creates them. + Clean up #if 0 code. + +2012-03-08 Tobias Burnus <burnus@net-b.de> + + PR fortran/52469 + * trans-types.c (gfc_get_function_type): Handle backend_decl + of a procedure pointer. + +2012-03-06 Steven Bosscher <steven@gcc.gnu.org> + + * f95-lang.c (yyerror, yylex): Remove. + (clear_binding_stack): Remove, fold into its only user. + (LANG_HOOKS_PRINT_IDENTIFIER): Do not re-define. + (ridpointers): Remove. + (gfc_eh_initialized_p): Make static. + (gfc_truthvalue_conversion): Move to convert.c. + (gfc_be_parse_file): Clear binding level stack when done. + (gfc_print_identifier): Remove. + (pushlevel): Remove ignored 'ignore' argument. Update all callers. + (poplevel): Remove unused 'reverse' argument. Update all callers. + (ggc_p): Remove. + (gfc_builtin_function): Make static. Do not attempt to make RTL for + builtin functions. + * convert.c (gfc_truthvalue_conversion): Moved here from f95-lang.c, + and made static. + * trans.h (pushlevel, poplevel): Adjust prototypes. + (gfc_truthvalue_conversion, gfc_builtin_function): Remove prototypes. + * trans-openmp.c: Update calls to pushlevel and poplevel. + * trans.c: Likewise. + * trans-decl.c: Likewise. + +2012-03-04 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/50981 + * gfortran.h (gfc_is_class_container_ref): New prototype. + * class.c (gfc_is_class_container_ref): New function. + * trans-expr.c (gfc_conv_procedure_call): Add a "_data" component + reference to polymorphic actual arguments. + +2012-03-04 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/50981 + * trans-expr.c (gfc_conv_procedure_call): Save se->ss's value. + Handle the case of unallocated arrays passed to elemental procedures. + +2012-03-04 Mikael Morin <mikael@gcc.gnu.org> + + * trans.h (struct gfc_ss_info): Move can_be_null_ref component from + the data::scalar subcomponent to the toplevel. + * trans-expr.c (gfc_conv_expr): Update component reference. + * trans-array.c (gfc_add_loop_ss_code): Ditto. + (gfc_walk_elemental_function_args): Ditto. Move the conditional setting + the field out of the scalar-only block. + +2012-03-04 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR fortran/36160 + * error.c (gfc_widechar_display_length, gfc_wide_display_length): + New functions. + (print_wide_char_into_buffer): Return length written. + (show_locus): Fix locus displayed when wide characters are present. + +2012-03-04 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + * module.c (gfc_use_module): Improve error message some more. + +2012-03-03 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + + PR fortran/52313 + * module.c (gfc_use_module): Improve error messages. + +2012-03-03 Tobias Burnus <burnus@net-b.de> + + PR fortran/48820 + * resolve.c (resolve_actual_arglist): Properly reset + assumed_type_expr_allowed. + +2012-03-03 Tobias Burnus <burnus@net-b.de> + + * lang.opt (Wc-binding-type): New flag. + * options.c (gfc_init_options, gfc_handle_option): Handle it. + * invoke.texi (Wc-binding-type): Document it. + * gfortran.h (gfc_option_t): Add warn_c_binding_type. + * decl.c (verify_bind_c_sym): Handle -Wc-binding-type. + * symbol.c (gfc_set_default_type, verify_bind_c_derived_type): + Ditto. + +2012-03-03 Tobias Burnus <burnus@net-b.de> + + PR fortran/48820 + * decl.c (gfc_match_decl_type_spec): Support type(*). + (gfc_verify_c_interop): Allow type(*). + * dump-parse-tree.c (show_typespec): Handle type(*). + * expr.c (gfc_copy_expr): Ditto. + * interface.c (compare_type_rank, compare_parameter, + compare_actual_formal, gfc_procedure_use): Ditto. + * libgfortran.h (bt): Add BT_ASSUMED. + * misc.c (gfc_basic_typename, gfc_typename): Handle type(*). + * module.c (bt_types): Ditto. + * resolve.c (assumed_type_expr_allowed): New static variable. + (resolve_actual_arglist, resolve_variable, resolve_symbol): + Handle type(*). + * trans-expr.c (gfc_conv_procedure_call): Ditto. + * trans-types.c (gfc_typenode_for_spec, gfc_get_dtype): Ditto. + +2012-03-02 Tobias Burnus <burnus@net-b.de> + + PR fortran/52325 + * primary.c (gfc_match_varspec): Add missing ;. + +2012-03-02 Tobias Burnus <burnus@net-b.de> + + PR fortran/52325 + * primary.c (gfc_match_varspec): Add diagnostic for % with + nonderived types. + +2012-03-02 Tobias Burnus <burnus@net-b.de> + + PR fortran/52270 + * expr.c (gfc_check_vardef_context): Fix check for + intent-in polymorphic pointer . + * interface.c (compare_parameter): Allow passing TYPE to + intent-in polymorphic pointer. + +2012-03-02 Tobias Burnus <burnus@net-b.de> + + PR fortran/52452 + * resolve.c (resolve_intrinsic): Don't search for a + function if we know that it is a subroutine. + +2012-02-29 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/52386 + * trans-expr.c (fcncall_realloc_result): Dereference the + descriptor if needed. + +2012-02-22 Tobias Burnus <burnus@net-b.de> + + PR fortran/52335 + * io.c (gfc_match_open): Remove bogus F2003 DELIM= check. + +2012-02-18 Tobias Burnus <burnus@net-b.de> + + PR fortran/52295 + * interface.c (check_interface0): Internal procs in + generic interfaces are allowed in Fortran 2008. + +2012-02-17 Tobias Burnus <burnus@net-b.de> + Roland Stigge <stigge@antcom.de> + + PR translation/52273 + * interface.c (compare_actual_formal): Fix typo "at at". + +2012-02-17 Tobias Burnus <burnus@net-b.de> + + * gfortran.texi (Q exponent-letter): Fix grammar. + +2012-02-17 Tobias Burnus <burnus@net-b.de> + + * gfortran.texi (Status): Fix typos. + * invoke.texi (ffixed-form, fstack-arrays): Spell Fortran with + a majuscule. + +2012-02-17 Tobias Burnus <burnus@net-b.de> + Roland Stigge <stigge@antcom.de> + + PR translation/52232 + PR translation/52234 + PR translation/52245 + PR translation/52246 + PR translation/52262 + PR translation/52273 + * io.c (gfc_match_open): Fix typo. + * interface.c (compare_actual_formal): Ditto. + * lang.opt (freal-4-real-8, freal-4-real-16, freal-8-real-16): Ditto. + * match.c (alloc_opt_list, gfc_match_nullify): Ditto. + * check.c (gfc_check_associated, gfc_check_null): Ditto. + +2012-02-12 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/50981 + * trans-stmt.c (gfc_get_proc_ifc_for_call): New function. + (gfc_trans_call): Use gfc_get_proc_ifc_for_call. + +2012-02-12 Mikael Morin <mikael@gcc.gnu.org> + + * trans-array.c (gfc_walk_elemental_function_args, + gfc_walk_function_expr): Move call to gfc_get_proc_ifc_for_expr out + of gfc_walk_elemental_function_args. + * trans-stmt.c (gfc_trans_call): Ditto. + * trans-array.h (gfc_get_proc_ifc_for_expr): New prototype. + (gfc_walk_elemental_function_args): Update prototype. + +2012-02-12 Mikael Morin <mikael@gcc.gnu.org> + + * trans-array.c (gfc_get_proc_ifc_for_expr): New function. + (gfc_walk_elemental_function_args): Move code to + gfc_get_proc_ifc_for_expr and call it. + +2012-02-08 Tobias Burnus <burnus@net-b.de> + + PR fortran/52151 + * trans-expr.c (fcncall_realloc_result): Set also the stride. + +2012-02-07 Tobias Burnus <burnus@net-b.de> + + PR fortran/51514 + * trans-expr.c (gfc_conv_procedure_call): Add _data component + for calls of scalar CLASS actuals to TYPE dummies. + +2012-02-05 Thomas König <tkoenig@gcc.gnu.org> + + PR fortran/48847 + * trans-decl.c: Warn about unused dummy procedure arguments + if -Wunused-dummy-argument is specified. Suppress middle-end + warnings about procedure arguments. + +2012-02-05 Paul Thomas <pault@gcc.gnu.org> + + * trans-array.c (gfc_array_allocate): Zero memory for all class + array allocations. + * trans-stmt.c (gfc_trans_allocate): Ditto for class scalars. + + PR fortran/52102 + * trans-stmt.c (gfc_trans_allocate): Before correcting a class + array reference, ensure that 'dataref' points to the _data + component that is followed by the array reference.. + +2012-02-02 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/41587 + PR fortran/46356 + PR fortran/51754 + PR fortran/50981 + * class.c (insert_component_ref, class_data_ref_missing, + gfc_fix_class_refs): New functions. + * gfortran.h (gfc_fix_class_refs): New prototype. + * trans-expr.c (gfc_conv_expr): Remove special case handling and call + gfc_fix_class_refs instead. + +2012-02-02 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/52012 + * trans-expr.c (fcncall_realloc_result): If variable shape is + correct, retain the bounds, whatever they are. + +2012-02-02 Tobias Burnus <burnus@net-b.de> + + PR fortran/52093 + * simplify.c (gfc_simplify_size): Handle INTRINSIC_PARENTHESES. + +2012-02-01 Thomas König <tkoenig@gcc.gnu.org> + + PR fortran/51958 + * frontend-passes.c (convert_elseif): New function. + (optimize_namespace): Call it. + +2012-02-01 Tobias Burnus <burnus@net-b.de> + + PR fortran/52024 + * module.c (MOD_VERSION): Bump. + (mio_typebound_proc): Read/write is_operator from/to the + .mod file. + +2012-02-01 Tobias Burnus <burnus@net-b.de> + + PR fortran/52059 + * trans-expr.c (gfc_conv_procedure_call): Add array ref + only to variables. + +2012-01-31 Tobias Burnus <burnus@net-b.de> + + PR fortran/52024 + * gfortran.h (gfc_tbp_generic): Store whether the + generic is an operator. + * decl.c (gfc_match_generic): Set that flag. + * resolve.c (check_generic_tbp_ambiguity): Use it in the + gfc_compare_interfaces check. + +2012-01-31 Tobias Burnus <burnus@net-b.de> + + PR fortran/52029 + * class.c (gfc_find_derived_vtab): Mark _copy function as pure. + +2012-01-31 Tobias Burnus <burnus@net-b.de> + + PR fortran/52013 + * class.c (get_unique_hashed_string): Adapt trim length. + (gfc_build_class_symbol) Encode also corank in the container name. + +2012-01-31 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/52012 + * trans-expr.c (fcncall_realloc_result): Correct calculation of + result offset. + +2012-01-29 Janne Blomqvist <jb@gcc.gnu.org> + + * module.c (pointer_info): Make true_name and module pointers + rather than arrays, order pointers before other fields. + (free_pi_tree): free true_name and module as well. + (mio_read_string): Rename to read_string. + (mio_write_string): Remove. + (load_commons): Use read_string. + (read_module): Use read_string rather than mio_internal_string. + (write_blank_common): Call write_atom directly. + (write_symbol): Likewise. + +2012-01-29 Tobias Burnus <burnus@net-b.de> + + PR fortran/41600 + * expr.c (gfc_default_initializer): Convert the values if + the type does not match. + +2012-01-29 Tobias Burnus <burnus@net-b.de> + + PR fortran/51972 + * trans-array.c (structure_alloc_comps): Fix assignment of + polymorphic components (polymorphic deep copying). + +2012-01-29 Janne Blomqvist <jb@gcc.gnu.org> + + PR fortran/51808 + * decl.c (set_binding_label): Make binding_label argument const. + (curr_binding_label): Constify. + * gfortran.h (gfc_symbol): Constify binding_label. + (gfc_common_head): Likewise. + (get_iso_c_sym): Likewise. + * match.c (gfc_match_name_C): Constify buffer argument. + * match.h (gfc_match_name_C): Likewise. + * resolve.c (set_name_and_label): Constify binding_label argument. + (gfc_iso_c_sub_interface): Constify binding_label variable. + * symbol.c (get_iso_c_sym): Constify binding_label argument. + +2012-01-29 Janne Blomqvist <jb@gcc.gnu.org> + + PR fortran/51808 + * decl.c (set_binding_label): Move prototype from match.h to here. + (curr_binding_label): Make a pointer rather than static array. + (build_sym): Check sym->binding_label pointer rather than array, + update set_binding_label call, handle curr_binding_label changes. + (set_binding_label): Handle new curr_binding_label, dest_label + double ptr, and sym->binding_label. + (verify_bind_c_sym): Handle sym->binding_label being a pointer. + (set_verify_bind_c_sym): Check sym->binding_label pointer rather + than array, update set_binding_label call. + (gfc_match_bind_c_stmt): Handle curr_binding_label change. + (match_procedure_decl): Update set_binding_label call. + (gfc_match_bind_c): Change binding_label to pointer, update + gfc_match_name_C call. + * gfortran.h (GFC_MAX_BINDING_LABEL_LEN): Remove macro. + (gfc_symbol): Make binding_label a pointer. + (gfc_common_head): Likewise. + * match.c (gfc_match_name_C): Heap allocate bind(C) name. + * match.h (gfc_match_name_C): Change prototype argument. + (set_binding_label): Move prototype to decl.c. + * module.c (struct pointer_info): Make binding_label a pointer. + (free_pi_tree): Free unused binding_label. + (mio_read_string): New function. + (mio_write_string): New function. + (load_commons): Redo reading of binding_label. + (read_module): Likewise. + (write_common_0): Change to write empty string instead of name if + no binding_label. + (write_blank_common): Write empty string for binding label. + (write_symbol): Change to write empty string instead of name if no + binding_label. + * resolve.c (gfc_iso_c_func_interface): Don't set binding_label. + (set_name_and_label): Make binding_label double pointer, use + asprintf. + (gfc_iso_c_sub_interface): Make binding_label a pointer. + (resolve_bind_c_comms): Handle cases if + gfc_common_head->binding_label is NULL. + (gfc_verify_binding_labels): sym->binding_label is a pointer. + * symbol.c (gfc_new_symbol): Rely on XCNEW zero init for + binding_label. + (gen_special_c_interop_ptr): Don't set binding label. + (generate_isocbinding_symbol): Insert binding_label into symbol + table. + (get_iso_c_sym): Use pointer assignment instead of strcpy. + * trans-common.c (gfc_sym_mangled_common_id): Handle + com->binding_label being a pointer. + * trans-decl.c (gfc_sym_mangled_identifier): Handle + sym->binding_label being a pointer. + (gfc_sym_mangled_function_id): Likewise. + +2012-01-29 Tobias Burnus <burnus@net-b.de> + + PR fortran/52038 + * resolve.c (symbol_as): Remove unused, accidentally + added function. + +2012-01-28 Tobias Burnus <burnus@net-b.de> + + PR fortran/51972 + * trans-stmt.c (gfc_trans_allocate): Properly check whether + we have a BT_CLASS which needs to be memset. + +2012-01-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/52022 + * trans-expr.c (gfc_conv_procedure_call): Fix passing + of functions, which return allocatables. + +2012-01-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/52016 + * resolve.c (resolve_formal_arglist): Fix elemental + constraint checks for polymorphic dummies also for + pointers. + +2012-01-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/51970 + PR fortran/51977 + * primary.c (gfc_match_varspec. gfc_match_rvalue): Set + handle array spec for BT_CLASS. + * expr.c (gfc_get_variable_expr, gfc_lval_expr_from_sym) + * frontend-passes.c (create_var): Ditto. + * resolve.c (resolve_actual_arglist, resolve_assoc_var): Ditto. + * trans-decl.c (gfc_trans_deferred_vars): Use class_pointer + instead of attr.pointer. + (gfc_generate_function_code): Use CLASS_DATA (sym) for BT_CLASS. + * trans-intrinsic.c (conv_intrinsic_move_alloc): Move assert. + * trans-stmt.c (trans_associate_var): Ask for the descriptor. + +2012-01-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/51953 + * match.c (gfc_match_allocate): Allow more than allocate + object with SOURCE=. + +2012-01-27 Tobias Burnus <burnus@net-b.de> + + PR fortran/52016 + * resolve.c (resolve_formal_arglist): Fix elemental + constraint checks for polymorphic dummies. + +2012-01-27 Paul Thomas <pault@gcc.gnu.org> + Tobias Burnus <burnus@gcc.gnu.org> + + PR fortran/48705 + PR fortran/51870 + PR fortran/51943 + PR fortran/51946 + * trans-array.c (gfc_array_init_size): Add two extra arguments + to convey the dynamic element size of a calls object and to + return the number of elements that have been allocated. + (gfc_array_allocate): Add the same arguments and use them to + call gfc_array_init_size. Before the allocation dereference + the data pointer, if necessary. Set the allocated array to zero + if the class element size or expr3 are non-null. + * trans-expr.c (gfc_conv_class_to_class): Give this function + global scope. + (get_class_array_ref): New function. + (gfc_copy_class_to_class): New function. + * trans-array.h : Update prototype for gfc_array_allocate. + * trans-stmt.c (gfc_trans_allocate): For non-variable class + STATUS expressions extract the class object and the dynamic + element size. Use the latter to call gfc_array_allocate and + the former for setting the vptr and, via + gfc_copy_class_to_clasfc_cs, to copy to the allocated data. + * trans.h : Prototypes for gfc_get_class_array_ref, + gfc_copy_class_to_class and gfc_conv_class_to_class. + +2012-01-25 Tobias Burnus <burnus@net-b.de> + + * resolve.c (symbol_as): Check also for attr.class_ok. + +2012-01-25 Tobias Burnus <burnus@net-b.de> + + PR fortran/51995 + * class.c (gfc_build_class_symbol): Fix invalid freeing + issue with fclass->f2k_derived. + +2012-01-25 Tobias Burnus <burnus@net-b.de> + + PR fortran/51995 + * class.c (gfc_build_class_symbol): Ensure that + fclass->f2k_derived is set. + +2012-01-25 Tobias Burnus <burnus@net-b.de> + + PR fortran/51966 + * resolve.c (resolve_structure_cons): Only create an + array constructors for nonscalars. + +2012-01-23 Tobias Burnus <burnus@net-b.de> + + PR fortran/51948 + * check.c (variable_check): Fix checking for + variables and deeply nested BLOCKs. + +2012-01-21 Tobias Burnus <burnus@net-b.de> + Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/50556 + * symbol.c (check_conflict): namelist-group-name cannot have the SAVE + attribute. + +2012-01-21 Tobias Burnus <burnus@net-b.de> + + PR fortran/51913 + * interface.c (compare_parameter): Fix CLASS comparison. + +2012-01-20 Tobias Burnus <burnus@net-b.de> + Janus Weil <janus@gcc.gnu.org> + + PR fortran/51056 + * module.c (load_needed, read_module): Don't mark __vtab etc. + as use_only. + +2012-01-19 Tobias Burnus <burnus@net-b.de> + + PR fortran/51904 + * expr.c (gfc_build_intrinsic_call): Also set the symtree. + +2012-01-18 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/51634 + * trans-expr.c (gfc_conv_procedure_call): Deallocate allocatable + components of temporary class arguments. + +2012-01-17 Tobias Burnus <burnus@net-b.de> + Janne Blomqvist <jb@gcc.gnu.org> + + PR fortran/51869 + * trans-expr.c (alloc_scalar_allocatable_for_assignment): Nullify + LHS after allocation, if it has allocatable components. + * f95-lang.c (gfc_init_builtin_functions): Add BUILT_IN_CALLOC. + +2012-01-16 Mikael Morin <mikael@gcc.gnu.org> + Tobias Burnus <burnus@net-b.de> + + PR fortran/50981 + * trans-array.c (gfc_walk_elemental_function_args): Fix + passing of deallocated allocatables/pointers as absent argument. + +2012-01-16 Tobias Burnus <burnus@net-b.de> + + PR fortran/51809 + * class.c (gfc_find_derived_vtab): Mark __vtab and + __def_init as FL_VARIABLE not as FL_PARAMETER. + * expr.c (gfc_simplify_expr): Remove special + handling of __vtab. + * resolve.c (resolve_values): Ditto. + * trans-decl.c (gfc_get_symbol_decl): Mark __vtab + and __def_init as TREE_READONLY. + +2012-01-16 Zydrunas Gimbutas <gimbutas@cims.nyu.edu> + Andreas Kloeckner <kloeckner@cims.nyu.edu> + Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/48426 + * gfortran.h (gfc_option_t): Add members flag_*_kind to store kind. + * lang.opt: Add options -freal-4-real-8, -freal-4-real-10, + -freal-4-real-16, -freal-8-real-4, -freal-8-real-10, -freal-8-real-16 + and -finteger-4-integer-8. User-desired type conversion information. + * decl.c (gfc_match_old_kind_spec,kind_expr): Type conversions + in declaration parsing. + * trans-types.c (gfc_init_kinds): User-specified type conversion + checked for current backend. + * primary.c (match_integer_constant,match_real_constant): Implement + type conversion in constant parsing. + * options.c (gfc_init_options,gfc_handle_option): Translate input + options to flags in internal options data structure. + * invoke.texi: Document new options. Re-order options in Options + summary section. + +2012-01-16 Paul Thomas <pault@gcc.gnu.org> + + * trans-array.c (gfc_trans_create_temp_array): In the case of a + class array temporary, detect a null 'eltype' on entry and use + 'initial' to provde the class reference and so, through the + vtable, the element size for the dynamic type. + * trans-stmt.c (gfc_conv_elemental_dependencies): For class + expressions, set 'eltype' to null and pass the values via the + 'initial' expression. + +2012-01-14 Tobias Burnus <burnus@net-b.de> + + PR fortran/51800 + * resolve.c (build_default_init_expr): Also initialize + nonconstant-length strings with -finit-character=<n>. + +2011-01-14 Tobias Burnus <burnus@net-b.de> + + PR fortran/51816 + * module.c (read_module): Don't make nonexisting + intrinsic operators as found. + (rename_list_remove_duplicate): New function. + (gfc_use_modules): Use it. + +2012-01-13 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/48351 + * trans-array.c (structure_alloc_comps): Suppress interative + call to self, when current component is deallocated using + gfc_trans_dealloc_allocated. + * class.c (gfc_build_class_symbol): Copy the 'alloc_comp' + attribute from the declared type to the class structure. + +2012-01-13 Tobias Burnus <burnus@net-b.de> + + PR fortran/51842 + * fortran/trans-types.c (gfc_init_kinds): Use PTRDIFF_TYPE + instead of a signed int of size POINTER_SIZE for + gfc_index_integer_kind. + +2012-01-12 Tobias Burnus <burnus@net-b.de> + + PR fortran/36755 + * intrinsic.texi (CHMOD): Extend a bit and remove statement + that /bin/chmod is called. + +2012-01-10 Gerald Pfeifer <gerald@pfeifer.com> + + * gfortran.texi (Fortran 2003 Status): Fix grammar. + +2012-01-10 Tobias Burnus <burnus@net-b.de> + + PR fortran/51652 + * resolve.c (resolve_allocate_expr): For non-deferred char lengths, + check whether type-spec matches declaration. + +2012-01-10 Tobias Burnus <burnus@net-b.de> + + * resolve.c (resolve_ordinary_assign): Improve error wording. + +2012-01-09 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/51791 + * interface.c (matching_typebound_op): Drill down through + possible parentheses to obtain base expression. Do not test for + 'class_ok' but, instead for the class structure components. + * resolve.c (resolve_ordinary_assign): Extend error message for + polymorphic assignment to advise checking for specific + subroutine. + + PR fortran/51792 + * resolve.c (resolve_typebound_function): Restore 'static' to + declaration. + +2012-01-09 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/51758 + * trans-array.c (gfc_walk_elemental_function_args): + Skip over NULL() actual arguments. + +2012-01-09 Tobias Burnus <burnus@net-b.de> + + * gfortran.texi: Bump copyright year. + (Fortran 2003 Status): Update polymorphism item, add + item for generic interface with DT name. + +2012-01-09 Tobias Burnus <burnus@net-b.de> + + PR fortran/51578 + * gfortran.h (gfc_use_list): + * match.h (gfc_use_module): Rename to ... + (gfc_use_modules): ... this. + * module.c (use_locus, specified_nonint, specified_int): Remove + global variable. + (module_name): Change type to const char*, used with gfc_get_string. + (module_list): New global variable. + (free_rename): Free argument not global var. + (gfc_match_use): Save match to module_list. + (load_generic_interfaces, read_module): Don't free symtree. + (write_dt_extensions, gfc_dump_module): Fix module-name I/O due to the + type change of module_name. + (write_symbol0, write_generic): Optimize due to the type change. + (import_iso_c_binding_module, use_iso_fortran_env_module): Use + locus of rename->where. + (gfc_use_module): Take module_list as argument. + (gfc_use_modules): New function. + (gfc_module_init_2, gfc_module_done_2): Init module_list, rename_list. + * parse.c (last_was_use_stmt): New global variable. + (use_modules): New function. + (decode_specification_statement, decode_statement): Move USE match up + and call use_modules. + (next_free, next_fixed): Call use_modules. + (accept_statement): Don't call gfc_module_use. + +2012-01-06 Tobias Burnus <burnus@net-b.de> + + * trans-openmp.c (gfc_omp_clause_dtor, gfc_trans_omp_array_reduction): + Update call to gfc_trans_dealloc_allocated. + * trans.c (gfc_allocate_using_malloc): Fix spacing. + (gfc_allocate_allocatable): For gfc_allocate_using_lib, jump to + label_finish when an error occurs. + (gfc_deallocate_with_status): Call caf_deregister for -fcoarray=lib. + * trans.h (gfc_allocate_allocatable, gfc_deallocate_with_status): + Update prototype. + (gfor_fndecl_caf_deregister): New tree symbol. + * trans-expr.c (gfc_conv_procedure_call): Update + gfc_deallocate_with_status and gfc_trans_dealloc_allocated calls. + * trans-array.c (gfc_array_allocate, gfc_trans_dealloc_allocated, + structure_alloc_comps, gfc_trans_deferred_array): Ditto. + (gfc_array_deallocate): Handle coarrays with -fcoarray=lib. + * trans-array.h (gfc_array_deallocate, gfc_array_allocate, + gfc_trans_dealloc_allocated): Update prototypes. + * trans-stmt.c (gfc_trans_sync): Fix indentation. + (gfc_trans_allocate): Fix errmsg padding and label handling. + (gfc_trans_deallocate): Ditto and handle -fcoarray=lib. + * expr.c (gfc_is_coarray): Fix algorithm for BT_CLASS. + * libgfortran.h (GFC_STAT_STOPPED_IMAGE): Use large value + to avoid other stats accidentally matching this one. + * trans-decl.c (gfor_fndecl_caf_deregister): New global var. + (gfc_build_builtin_function_decls): Fix prototype decl of caf_register + and add decl for caf_deregister. + (gfc_trans_deferred_vars): Handle CAF vars with -fcoarrays=lib. + * trans-intrinsic.c (conv_intrinsic_move_alloc): Update call to + gfc_deallocate_with_status. + +2012-01-05 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/PR48946 + * resolve.c (resolve_typebound_static): If the typebound + procedure is 'deferred' try to find the correct specific + procedure in the derived type operator space itself. + +2012-01-04 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/50981 + * trans-array.h (gfc_walk_elemental_function_args): New argument. + * trans-intrinsic.c (gfc_walk_intrinsic_function): Update call. + * trans-stmt.c (gfc_trans_call): Ditto. + * trans-array.c (gfc_walk_function_expr): Ditto. + (gfc_walk_elemental_function_args): Get the dummy argument list + if possible. Check that the dummy and the actual argument are both + optional, and set can_be_null_ref accordingly. + +2012-01-04 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/50981 + * trans.h (struct gfc_ss_info): New field data::scalar::can_be_null_ref + * trans-array.c: If the reference can be NULL, save the reference + instead of the value. + * trans-expr.c (gfc_conv_expr): If we have saved a reference, + dereference it. + +2012-01-04 Mikael Morin <mikael@gcc.gnu.org> + + * trans-expr.c (gfc_conv_expr): Move address taking... + (gfc_conv_expr_reference): ... here. + +2012-01-04 Thomas Koenig <tkoenig@gcc.gnu.org> + + PR fortran/49693 + * trans-common.c (create_common): Update copyright years. Mark + variables as used to avoid warnings about unused variables in + common blocks. + +2012-01-03 Hans-Peter Nilsson <hp@axis.com> + + * gfortran.h (struct gfc_expr): Add missing "struct" + qualifier for member base_expr. + +2012-01-02 Paul Thomas <pault@gcc.gnu.org> + + PR fortran/51529 + * trans-array.c (gfc_array_allocate): Null allocated memory of + newly allocted class arrays. + + PR fortran/46262 + PR fortran/46328 + PR fortran/51052 + * interface.c(build_compcall_for_operator): Add a type to the + expression. + * trans-expr.c (conv_base_obj_fcn_val): New function. + (gfc_conv_procedure_call): Use base_expr to detect non-variable + base objects and, ensuring that there is a temporary variable, + build up the typebound call using conv_base_obj_fcn_val. + (gfc_trans_class_assign): Pick out class procedure pointer + assignments and do the assignment with no further prcessing. + (gfc_trans_class_array_init_assign, gfc_trans_class_init_assign + gfc_trans_class_assign): Move to top of file. + * gfortran.h : Add 'base_expr' field to gfc_expr. + * resolve.c (get_declared_from_expr): Add 'types' argument to + switch checking of derived types on or off. + (resolve_typebound_generic_call): Set the new argument. + (resolve_typebound_function, resolve_typebound_subroutine): + Set 'types' argument for get_declared_from_expr appropriately. + Identify base expression, if not a variable, in the argument + list of class valued calls. Assign it to the 'base_expr' field + of the final expression. Strip away all references after the + last class reference. + +2012-01-02 Tobias Burnus <burnus@net-b.de> + + PR fortran/51682 + * trans-intrinsic.c (trans_this_image, trans_image_index, + trans_num_images, conv_intrinsic_cobound): Fold_convert the + caf_num_images/caf_this_images variables to the correct int kind. + +2012-01-01 Jakub Jelinek <jakub@redhat.com> + + * gfortranspec.c (lang_specific_driver): Update copyright notice + dates. + +Copyright (C) 2012 Free Software Foundation, Inc. + +Copying and distribution of this file, with or without modification, +are permitted in any medium without royalty provided the copyright +notice and this notice are preserved. diff --git a/gcc/fortran/arith.c b/gcc/fortran/arith.c index e94566aa65c..1f70d89a9aa 100644 --- a/gcc/fortran/arith.c +++ b/gcc/fortran/arith.c @@ -1,6 +1,6 @@ /* Compiler arithmetic Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010 + 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Andy Vaught diff --git a/gcc/fortran/bbt.c b/gcc/fortran/bbt.c index 000f04bcbf8..8c1344c0a30 100644 --- a/gcc/fortran/bbt.c +++ b/gcc/fortran/bbt.c @@ -1,5 +1,5 @@ /* Balanced binary trees using treaps. - Copyright (C) 2000, 2002, 2003, 2007, 2008, 2010 + Copyright (C) 2000, 2002, 2003, 2007, 2008, 2010, 2012 Free Software Foundation, Inc. Contributed by Andy Vaught diff --git a/gcc/fortran/class.c b/gcc/fortran/class.c index 61d65e7a30b..0d34e78e5de 100644 --- a/gcc/fortran/class.c +++ b/gcc/fortran/class.c @@ -1,5 +1,5 @@ /* Implementation of Fortran 2003 Polymorphism. - Copyright (C) 2009, 2010, 2011, 2012 + Copyright (C) 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. Contributed by Paul Richard Thomas <pault@gcc.gnu.org> and Janus Weil <janus@gcc.gnu.org> @@ -165,7 +165,23 @@ gfc_fix_class_refs (gfc_expr *e) && e->value.function.isym != NULL)) return; - ts = &e->symtree->n.sym->ts; + if (e->expr_type == EXPR_VARIABLE) + ts = &e->symtree->n.sym->ts; + else + { + gfc_symbol *func; + + gcc_assert (e->expr_type == EXPR_FUNCTION); + if (e->value.function.esym != NULL) + func = e->value.function.esym; + else + func = e->symtree->n.sym; + + if (func->result != NULL) + ts = &func->result->ts; + else + ts = &func->ts; + } for (ref = &e->ref; *ref != NULL; ref = &(*ref)->next) { @@ -414,7 +430,7 @@ gfc_class_null_initializer (gfc_typespec *ts, gfc_expr *init_expr) && ts->u.derived->components->ts.u.derived->attr.unlimited_polymorphic; if (is_unlimited_polymorphic && init_expr) - vtab = gfc_find_intrinsic_vtab (&(init_expr->ts)); + vtab = gfc_find_intrinsic_vtab (&ts->u.derived->components->ts); else vtab = gfc_find_derived_vtab (ts->u.derived); @@ -597,7 +613,7 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_attribute *attr, fclass->refs++; fclass->ts.type = BT_UNKNOWN; if (!ts->u.derived->attr.unlimited_polymorphic) - fclass->attr.abstract = ts->u.derived->attr.abstract; + fclass->attr.abstract = ts->u.derived->attr.abstract; fclass->f2k_derived = gfc_get_namespace (NULL, 0); if (gfc_add_flavor (&fclass->attr, FL_DERIVED, NULL, &gfc_current_locus) == FAILURE) @@ -924,14 +940,14 @@ finalize_component (gfc_expr *expr, gfc_symbol *derived, gfc_component *comp, /* Generate code equivalent to CALL C_F_POINTER (TRANSFER (TRANSFER (C_LOC (array, cptr), c_intptr) - + idx * stride, c_ptr), ptr). */ + + offset, c_ptr), ptr). */ static gfc_code * -finalization_scalarizer (gfc_symbol *idx, gfc_symbol *array, gfc_symbol *ptr, - gfc_expr *stride, gfc_namespace *sub_ns) +finalization_scalarizer (gfc_symbol *array, gfc_symbol *ptr, + gfc_expr *offset, gfc_namespace *sub_ns) { gfc_code *block; - gfc_expr *expr, *expr2, *expr3; + gfc_expr *expr, *expr2; /* C_F_POINTER(). */ block = XCNEW (gfc_code); @@ -961,6 +977,7 @@ finalization_scalarizer (gfc_symbol *idx, gfc_symbol *array, gfc_symbol *ptr, = gfc_intrinsic_function_by_id (GFC_ISYM_TRANSFER); /* Set symtree for -fdump-parse-tree. */ gfc_get_sym_tree ("transfer", sub_ns, &expr2->symtree, false); + expr2->symtree->n.sym->intmod_sym_id = GFC_ISYM_TRANSFER; expr2->symtree->n.sym->attr.flavor = FL_PROCEDURE; expr2->symtree->n.sym->attr.intrinsic = 1; gfc_commit_symbol (expr2->symtree->n.sym); @@ -995,21 +1012,12 @@ finalization_scalarizer (gfc_symbol *idx, gfc_symbol *array, gfc_symbol *ptr, expr->ts.kind = gfc_index_integer_kind; expr2->value.function.actual->expr = expr; - /* Offset calculation: idx * stride (in bytes). */ - block->ext.actual->expr = gfc_get_expr (); - expr3 = block->ext.actual->expr; - expr3->expr_type = EXPR_OP; - expr3->value.op.op = INTRINSIC_TIMES; - expr3->value.op.op1 = gfc_lval_expr_from_sym (idx); - expr3->value.op.op2 = stride; - expr3->ts = expr->ts; - /* <array addr> + <offset>. */ block->ext.actual->expr = gfc_get_expr (); block->ext.actual->expr->expr_type = EXPR_OP; block->ext.actual->expr->value.op.op = INTRINSIC_PLUS; block->ext.actual->expr->value.op.op1 = expr2; - block->ext.actual->expr->value.op.op2 = expr3; + block->ext.actual->expr->value.op.op2 = offset; block->ext.actual->expr->ts = expr->ts; /* C_F_POINTER's 2nd arg: ptr -- and its absent shape=. */ @@ -1021,39 +1029,183 @@ finalization_scalarizer (gfc_symbol *idx, gfc_symbol *array, gfc_symbol *ptr, } +/* Calculates the offset to the (idx+1)th element of an array, taking the + stride into account. It generates the code: + offset = 0 + do idx2 = 1, rank + offset = offset + mod (idx, sizes(idx2)) / sizes(idx2-1) * strides(idx2) + end do + offset = offset * byte_stride. */ + +static gfc_code* +finalization_get_offset (gfc_symbol *idx, gfc_symbol *idx2, gfc_symbol *offset, + gfc_symbol *strides, gfc_symbol *sizes, + gfc_symbol *byte_stride, gfc_expr *rank, + gfc_code *block, gfc_namespace *sub_ns) +{ + gfc_iterator *iter; + gfc_expr *expr, *expr2; + + /* offset = 0. */ + block->next = XCNEW (gfc_code); + block = block->next; + block->op = EXEC_ASSIGN; + block->loc = gfc_current_locus; + block->expr1 = gfc_lval_expr_from_sym (offset); + block->expr2 = gfc_get_int_expr (gfc_index_integer_kind, NULL, 0); + + /* Create loop. */ + iter = gfc_get_iterator (); + iter->var = gfc_lval_expr_from_sym (idx2); + iter->start = gfc_get_int_expr (gfc_index_integer_kind, NULL, 1); + iter->end = gfc_copy_expr (rank); + iter->step = gfc_get_int_expr (gfc_index_integer_kind, NULL, 1); + block->next = XCNEW (gfc_code); + block = block->next; + block->op = EXEC_DO; + block->loc = gfc_current_locus; + block->ext.iterator = iter; + block->block = gfc_get_code (); + block->block->op = EXEC_DO; + + /* Loop body: offset = offset + mod (idx, sizes(idx2)) / sizes(idx2-1) + * strides(idx2). */ + + /* mod (idx, sizes(idx2)). */ + expr = gfc_get_expr (); + expr->expr_type = EXPR_FUNCTION; + expr->value.function.isym = gfc_intrinsic_function_by_id (GFC_ISYM_MOD); + gfc_get_sym_tree ("mod", sub_ns, &expr->symtree, false); + expr->symtree->n.sym->intmod_sym_id = GFC_ISYM_MOD; + expr->symtree->n.sym->attr.flavor = FL_PROCEDURE; + expr->symtree->n.sym->attr.intrinsic = 1; + gfc_commit_symbol (expr->symtree->n.sym); + expr->value.function.actual = gfc_get_actual_arglist (); + expr->value.function.actual->expr = gfc_lval_expr_from_sym (idx); + expr->value.function.actual->next = gfc_get_actual_arglist (); + expr->value.function.actual->next->expr = gfc_lval_expr_from_sym (sizes); + expr->value.function.actual->next->expr->ref = gfc_get_ref (); + expr->value.function.actual->next->expr->ref->type = REF_ARRAY; + expr->value.function.actual->next->expr->ref->u.ar.as = sizes->as; + expr->value.function.actual->next->expr->ref->u.ar.type = AR_ELEMENT; + expr->value.function.actual->next->expr->ref->u.ar.dimen = 1; + expr->value.function.actual->next->expr->ref->u.ar.dimen_type[0] + = DIMEN_ELEMENT; + expr->value.function.actual->next->expr->ref->u.ar.start[0] + = gfc_lval_expr_from_sym (idx2); + expr->ts = idx->ts; + + /* (...) / sizes(idx2-1). */ + expr2 = gfc_get_expr (); + expr2->expr_type = EXPR_OP; + expr2->value.op.op = INTRINSIC_DIVIDE; + expr2->value.op.op1 = expr; + expr2->value.op.op2 = gfc_lval_expr_from_sym (sizes); + expr2->value.op.op2->ref = gfc_get_ref (); + expr2->value.op.op2->ref->type = REF_ARRAY; + expr2->value.op.op2->ref->u.ar.as = sizes->as; + expr2->value.op.op2->ref->u.ar.type = AR_ELEMENT; + expr2->value.op.op2->ref->u.ar.dimen = 1; + expr2->value.op.op2->ref->u.ar.dimen_type[0] = DIMEN_ELEMENT; + expr2->value.op.op2->ref->u.ar.start[0] = gfc_get_expr (); + expr2->value.op.op2->ref->u.ar.start[0]->expr_type = EXPR_OP; + expr2->value.op.op2->ref->u.ar.start[0]->value.op.op = INTRINSIC_MINUS; + expr2->value.op.op2->ref->u.ar.start[0]->value.op.op1 + = gfc_lval_expr_from_sym (idx2); + expr2->value.op.op2->ref->u.ar.start[0]->value.op.op2 + = gfc_get_int_expr (gfc_index_integer_kind, NULL, 1); + expr2->value.op.op2->ref->u.ar.start[0]->ts + = expr2->value.op.op2->ref->u.ar.start[0]->value.op.op1->ts; + expr2->ts = idx->ts; + + /* ... * strides(idx2). */ + expr = gfc_get_expr (); + expr->expr_type = EXPR_OP; + expr->value.op.op = INTRINSIC_TIMES; + expr->value.op.op1 = expr2; + expr->value.op.op2 = gfc_lval_expr_from_sym (strides); + expr->value.op.op2->ref = gfc_get_ref (); + expr->value.op.op2->ref->type = REF_ARRAY; + expr->value.op.op2->ref->u.ar.type = AR_ELEMENT; + expr->value.op.op2->ref->u.ar.dimen = 1; + expr->value.op.op2->ref->u.ar.dimen_type[0] = DIMEN_ELEMENT; + expr->value.op.op2->ref->u.ar.start[0] = gfc_lval_expr_from_sym (idx2); + expr->value.op.op2->ref->u.ar.as = strides->as; + expr->ts = idx->ts; + + /* offset = offset + ... */ + block->block->next = XCNEW (gfc_code); + block->block->next->op = EXEC_ASSIGN; + block->block->next->loc = gfc_current_locus; + block->block->next->expr1 = gfc_lval_expr_from_sym (offset); + block->block->next->expr2 = gfc_get_expr (); + block->block->next->expr2->expr_type = EXPR_OP; + block->block->next->expr2->value.op.op = INTRINSIC_PLUS; + block->block->next->expr2->value.op.op1 = gfc_lval_expr_from_sym (offset); + block->block->next->expr2->value.op.op2 = expr; + block->block->next->expr2->ts = idx->ts; + + /* After the loop: offset = offset * byte_stride. */ + block->next = XCNEW (gfc_code); + block = block->next; + block->op = EXEC_ASSIGN; + block->loc = gfc_current_locus; + block->expr1 = gfc_lval_expr_from_sym (offset); + block->expr2 = gfc_get_expr (); + block->expr2->expr_type = EXPR_OP; + block->expr2->value.op.op = INTRINSIC_TIMES; + block->expr2->value.op.op1 = gfc_lval_expr_from_sym (offset); + block->expr2->value.op.op2 = gfc_lval_expr_from_sym (byte_stride); + block->expr2->ts = block->expr2->value.op.op1->ts; + return block; +} + + /* Insert code of the following form: - if (stride == STORAGE_SIZE (array)/NUMERIC_STORAGE_SIZE - || 0 == STORAGE_SIZE (array)) then - call final_rank3 (array) - else - block - type(t) :: tmp(shape (array)) - - do i = 0, size (array)-1 - addr = transfer (c_loc (array), addr) + i * stride - call c_f_pointer (transfer (addr, cptr), ptr) - - addr = transfer (c_loc (tmp), addr) - + i * STORAGE_SIZE (array)/NUMERIC_STORAGE_SIZE - call c_f_pointer (transfer (addr, cptr), ptr2) - ptr2 = ptr - end do - call final_rank3 (tmp) - end block - end if */ + block + integer(c_intptr_t) :: i + + if ((byte_stride == STORAGE_SIZE (array)/NUMERIC_STORAGE_SIZE + && (is_contiguous || !final_rank3->attr.contiguous + || final_rank3->as->type != AS_ASSUMED_SHAPE)) + || 0 == STORAGE_SIZE (array)) then + call final_rank3 (array) + else + block + integer(c_intptr_t) :: offset, j + type(t) :: tmp(shape (array)) + + do i = 0, size (array)-1 + offset = obtain_offset(i, strides, sizes, byte_stride) + addr = transfer (c_loc (array), addr) + offset + call c_f_pointer (transfer (addr, cptr), ptr) + + addr = transfer (c_loc (tmp), addr) + + i * STORAGE_SIZE (array)/NUMERIC_STORAGE_SIZE + call c_f_pointer (transfer (addr, cptr), ptr2) + ptr2 = ptr + end do + call final_rank3 (tmp) + end block + end if + block */ static void finalizer_insert_packed_call (gfc_code *block, gfc_finalizer *fini, - gfc_symbol *array, gfc_symbol *stride, + gfc_symbol *array, gfc_symbol *byte_stride, gfc_symbol *idx, gfc_symbol *ptr, gfc_symbol *nelem, gfc_symtree *size_intr, + gfc_symbol *strides, gfc_symbol *sizes, + gfc_symbol *idx2, gfc_symbol *offset, + gfc_symbol *is_contiguous, gfc_expr *rank, gfc_namespace *sub_ns) { gfc_symbol *tmp_array, *ptr2; - gfc_expr *size_expr; + gfc_expr *size_expr, *offset2, *expr; gfc_namespace *ns; gfc_iterator *iter; + gfc_code *block2; int i; block->next = XCNEW (gfc_code); @@ -1080,6 +1232,8 @@ finalizer_insert_packed_call (gfc_code *block, gfc_finalizer *fini, = gfc_intrinsic_function_by_id (GFC_ISYM_STORAGE_SIZE); gfc_get_sym_tree ("storage_size", sub_ns, &size_expr->value.op.op1->symtree, false); + size_expr->value.op.op1->symtree->n.sym->intmod_sym_id + = GFC_ISYM_STORAGE_SIZE; size_expr->value.op.op1->symtree->n.sym->attr.flavor = FL_PROCEDURE; size_expr->value.op.op1->symtree->n.sym->attr.intrinsic = 1; gfc_commit_symbol (size_expr->value.op.op1->symtree->n.sym); @@ -1096,32 +1250,53 @@ finalizer_insert_packed_call (gfc_code *block, gfc_finalizer *fini, size_expr->value.op.op1->ts = size_expr->value.op.op2->ts; size_expr->ts = size_expr->value.op.op1->ts; - /* IF condition: stride == size_expr || 0 == size_expr. */ + /* IF condition: (stride == size_expr + && ((fini's as->ASSUMED_SIZE && !fini's attr.contiguous) + || is_contiguous) + || 0 == size_expr. */ block->expr1 = gfc_get_expr (); block->expr1->expr_type = EXPR_FUNCTION; block->expr1->ts.type = BT_LOGICAL; - block->expr1->ts.kind = 4; + block->expr1->ts.kind = gfc_default_logical_kind; block->expr1->expr_type = EXPR_OP; block->expr1->where = gfc_current_locus; block->expr1->value.op.op = INTRINSIC_OR; - /* stride == size_expr */ - block->expr1->value.op.op1 = gfc_get_expr (); - block->expr1->value.op.op1->expr_type = EXPR_FUNCTION; - block->expr1->value.op.op1->ts.type = BT_LOGICAL; - block->expr1->value.op.op1->ts.kind = 4; - block->expr1->value.op.op1->expr_type = EXPR_OP; - block->expr1->value.op.op1->where = gfc_current_locus; - block->expr1->value.op.op1->value.op.op = INTRINSIC_EQ; - block->expr1->value.op.op1->value.op.op1 = gfc_lval_expr_from_sym (stride); - block->expr1->value.op.op1->value.op.op2 = size_expr; + /* byte_stride == size_expr */ + expr = gfc_get_expr (); + expr->ts.type = BT_LOGICAL; + expr->ts.kind = gfc_default_logical_kind; + expr->expr_type = EXPR_OP; + expr->where = gfc_current_locus; + expr->value.op.op = INTRINSIC_EQ; + expr->value.op.op1 + = gfc_lval_expr_from_sym (byte_stride); + expr->value.op.op2 = size_expr; + + /* If strides aren't allowd (not assumed shape or CONTIGUOUS), + add is_contiguous check. */ + if (fini->proc_tree->n.sym->formal->sym->as->type != AS_ASSUMED_SHAPE + || fini->proc_tree->n.sym->formal->sym->attr.contiguous) + { + gfc_expr *expr2; + expr2 = gfc_get_expr (); + expr2->ts.type = BT_LOGICAL; + expr2->ts.kind = gfc_default_logical_kind; + expr2->expr_type = EXPR_OP; + expr2->where = gfc_current_locus; + expr2->value.op.op = INTRINSIC_AND; + expr2->value.op.op1 = expr; + expr2->value.op.op2 = gfc_lval_expr_from_sym (is_contiguous); + expr = expr2; + } + + block->expr1->value.op.op1 = expr; /* 0 == size_expr */ block->expr1->value.op.op2 = gfc_get_expr (); - block->expr1->value.op.op2->expr_type = EXPR_FUNCTION; block->expr1->value.op.op2->ts.type = BT_LOGICAL; - block->expr1->value.op.op2->ts.kind = 4; + block->expr1->value.op.op2->ts.kind = gfc_default_logical_kind; block->expr1->value.op.op2->expr_type = EXPR_OP; block->expr1->value.op.op2->where = gfc_current_locus; block->expr1->value.op.op2->value.op.op = INTRINSIC_EQ; @@ -1168,7 +1343,6 @@ finalizer_insert_packed_call (gfc_code *block, gfc_finalizer *fini, tmp_array->ts.type = BT_DERIVED; tmp_array->ts.u.derived = array->ts.u.derived; tmp_array->attr.flavor = FL_VARIABLE; - tmp_array->attr.contiguous = 1; tmp_array->attr.dimension = 1; tmp_array->attr.artificial = 1; tmp_array->as = gfc_get_array_spec(); @@ -1217,22 +1391,36 @@ finalizer_insert_packed_call (gfc_code *block, gfc_finalizer *fini, block->block = gfc_get_code (); block->block->op = EXEC_DO; + /* Offset calculation for the new array: idx * size of type (in bytes). */ + offset2 = gfc_get_expr (); + offset2 = block->ext.actual->expr; + offset2->expr_type = EXPR_OP; + offset2->value.op.op = INTRINSIC_TIMES; + offset2->value.op.op1 = gfc_lval_expr_from_sym (idx); + offset2->value.op.op2 = gfc_copy_expr (size_expr); + offset2->ts = byte_stride->ts; + + /* Offset calculation of "array". */ + block2 = finalization_get_offset (idx, idx2, offset, strides, sizes, + byte_stride, rank, block->block, sub_ns); + /* Create code for CALL C_F_POINTER (TRANSFER (TRANSFER (C_LOC (array, cptr), c_intptr) + idx * stride, c_ptr), ptr). */ - block->block->next = finalization_scalarizer (idx, array, ptr, - gfc_lval_expr_from_sym (stride), - sub_ns); - block->block->next->next = finalization_scalarizer (idx, tmp_array, ptr2, - gfc_copy_expr (size_expr), - sub_ns); + block2->next = finalization_scalarizer (array, ptr, + gfc_lval_expr_from_sym (offset), + sub_ns); + block2 = block2->next; + block2->next = finalization_scalarizer (tmp_array, ptr2, offset2, sub_ns); + /* ptr2 = ptr. */ - block->block->next->next->next = XCNEW (gfc_code); - block->block->next->next->next->op = EXEC_ASSIGN; - block->block->next->next->next->loc = gfc_current_locus; - block->block->next->next->next->expr1 = gfc_lval_expr_from_sym (ptr2); - block->block->next->next->next->expr2 = gfc_lval_expr_from_sym (ptr); + block2->next = XCNEW (gfc_code); + block2->next->op = EXEC_ASSIGN; + block2->next->loc = gfc_current_locus; + block2->next->expr1 = gfc_lval_expr_from_sym (ptr2); + block2->next->expr2 = gfc_lval_expr_from_sym (ptr); + /* Call now the user's final subroutine. */ block->next = XCNEW (gfc_code); block = block->next; block->op = EXEC_CALL; @@ -1262,21 +1450,26 @@ finalizer_insert_packed_call (gfc_code *block, gfc_finalizer *fini, block->block = gfc_get_code (); block->block->op = EXEC_DO; + /* Offset calculation of "array". */ + block2 = finalization_get_offset (idx, idx2, offset, strides, sizes, + byte_stride, rank, block->block, sub_ns); + /* Create code for CALL C_F_POINTER (TRANSFER (TRANSFER (C_LOC (array, cptr), c_intptr) - + idx * stride, c_ptr), ptr). */ - block->block->next = finalization_scalarizer (idx, array, ptr, - gfc_lval_expr_from_sym (stride), - sub_ns); - block->block->next->next = finalization_scalarizer (idx, tmp_array, ptr2, - gfc_copy_expr (size_expr), - sub_ns); + + offset, c_ptr), ptr). */ + block2->next = finalization_scalarizer (array, ptr, + gfc_lval_expr_from_sym (offset), + sub_ns); + block2 = block2->next; + block2->next = finalization_scalarizer (tmp_array, ptr2, offset2, sub_ns); + block2 = block2->next; + /* ptr = ptr2. */ - block->block->next->next->next = XCNEW (gfc_code); - block->block->next->next->next->op = EXEC_ASSIGN; - block->block->next->next->next->loc = gfc_current_locus; - block->block->next->next->next->expr1 = gfc_lval_expr_from_sym (ptr); - block->block->next->next->next->expr2 = gfc_lval_expr_from_sym (ptr2); + block2->next = XCNEW (gfc_code); + block2->next->op = EXEC_ASSIGN; + block2->next->loc = gfc_current_locus; + block2->next->expr1 = gfc_lval_expr_from_sym (ptr); + block2->next->expr2 = gfc_lval_expr_from_sym (ptr2); } @@ -1300,16 +1493,17 @@ static void generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, const char *tname, gfc_component *vtab_final) { - gfc_symbol *final, *array, *nelem, *fini_coarray, *stride; - gfc_symbol *ptr = NULL, *idx = NULL; + gfc_symbol *final, *array, *fini_coarray, *byte_stride, *sizes, *strides; + gfc_symbol *ptr = NULL, *idx, *idx2, *is_contiguous, *offset, *nelem; gfc_symtree *size_intr; gfc_component *comp; gfc_namespace *sub_ns; - gfc_code *last_code; + gfc_code *last_code, *block; char name[GFC_MAX_SYMBOL_LEN+1]; bool finalizable_comp = false; bool expr_null_wrapper = false; - gfc_expr *ancestor_wrapper = NULL; + gfc_expr *ancestor_wrapper = NULL, *rank; + gfc_iterator *iter; /* Search for the ancestor's finalizers. */ if (derived->attr.extension && derived->components @@ -1423,22 +1617,22 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, gfc_commit_symbol (array); /* Set up formal argument. */ - gfc_get_symbol ("stride", sub_ns, &stride); - stride->ts.type = BT_INTEGER; - stride->ts.kind = gfc_index_integer_kind; - stride->attr.flavor = FL_VARIABLE; - stride->attr.dummy = 1; - stride->attr.value = 1; - stride->attr.artificial = 1; - gfc_set_sym_referenced (stride); + gfc_get_symbol ("byte_stride", sub_ns, &byte_stride); + byte_stride->ts.type = BT_INTEGER; + byte_stride->ts.kind = gfc_index_integer_kind; + byte_stride->attr.flavor = FL_VARIABLE; + byte_stride->attr.dummy = 1; + byte_stride->attr.value = 1; + byte_stride->attr.artificial = 1; + gfc_set_sym_referenced (byte_stride); final->formal->next = gfc_get_formal_arglist (); - final->formal->next->sym = stride; - gfc_commit_symbol (stride); + final->formal->next->sym = byte_stride; + gfc_commit_symbol (byte_stride); /* Set up formal argument. */ gfc_get_symbol ("fini_coarray", sub_ns, &fini_coarray); fini_coarray->ts.type = BT_LOGICAL; - fini_coarray->ts.kind = 4; + fini_coarray->ts.kind = 1; fini_coarray->attr.flavor = FL_VARIABLE; fini_coarray->attr.dummy = 1; fini_coarray->attr.value = 1; @@ -1457,6 +1651,90 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, return; } + /* Local variables. */ + + gfc_get_symbol ("idx", sub_ns, &idx); + idx->ts.type = BT_INTEGER; + idx->ts.kind = gfc_index_integer_kind; + idx->attr.flavor = FL_VARIABLE; + idx->attr.artificial = 1; + gfc_set_sym_referenced (idx); + gfc_commit_symbol (idx); + + gfc_get_symbol ("idx2", sub_ns, &idx2); + idx2->ts.type = BT_INTEGER; + idx2->ts.kind = gfc_index_integer_kind; + idx2->attr.flavor = FL_VARIABLE; + idx2->attr.artificial = 1; + gfc_set_sym_referenced (idx2); + gfc_commit_symbol (idx2); + + gfc_get_symbol ("offset", sub_ns, &offset); + offset->ts.type = BT_INTEGER; + offset->ts.kind = gfc_index_integer_kind; + offset->attr.flavor = FL_VARIABLE; + offset->attr.artificial = 1; + gfc_set_sym_referenced (offset); + gfc_commit_symbol (offset); + + /* Create RANK expression. */ + rank = gfc_get_expr (); + rank->expr_type = EXPR_FUNCTION; + rank->value.function.isym = gfc_intrinsic_function_by_id (GFC_ISYM_RANK); + gfc_get_sym_tree ("rank", sub_ns, &rank->symtree, false); + rank->symtree->n.sym->intmod_sym_id = GFC_ISYM_RANK; + rank->symtree->n.sym->attr.flavor = FL_PROCEDURE; + rank->symtree->n.sym->attr.intrinsic = 1; + gfc_commit_symbol (rank->symtree->n.sym); + rank->value.function.actual = gfc_get_actual_arglist (); + rank->value.function.actual->expr = gfc_lval_expr_from_sym (array); + rank->ts = rank->value.function.isym->ts; + gfc_convert_type (rank, &idx->ts, 2); + + /* Create is_contiguous variable. */ + gfc_get_symbol ("is_contiguous", sub_ns, &is_contiguous); + is_contiguous->ts.type = BT_LOGICAL; + is_contiguous->ts.kind = gfc_default_logical_kind; + is_contiguous->attr.flavor = FL_VARIABLE; + is_contiguous->attr.artificial = 1; + gfc_set_sym_referenced (is_contiguous); + gfc_commit_symbol (is_contiguous); + + /* Create "sizes(0..rank)" variable, which contains the multiplied + up extent of the dimensions, i.e. sizes(0) = 1, sizes(1) = extent(dim=1), + sizes(2) = sizes(1) * extent(dim=2) etc. */ + gfc_get_symbol ("sizes", sub_ns, &sizes); + sizes->ts.type = BT_INTEGER; + sizes->ts.kind = gfc_index_integer_kind; + sizes->attr.flavor = FL_VARIABLE; + sizes->attr.dimension = 1; + sizes->attr.artificial = 1; + sizes->as = gfc_get_array_spec(); + sizes->attr.intent = INTENT_INOUT; + sizes->as->type = AS_EXPLICIT; + sizes->as->rank = 1; + sizes->as->lower[0] = gfc_get_int_expr (gfc_index_integer_kind, NULL, 0); + sizes->as->upper[0] = gfc_copy_expr (rank); + gfc_set_sym_referenced (sizes); + gfc_commit_symbol (sizes); + + /* Create "strides(1..rank)" variable, which contains the strides per + dimension. */ + gfc_get_symbol ("strides", sub_ns, &strides); + strides->ts.type = BT_INTEGER; + strides->ts.kind = gfc_index_integer_kind; + strides->attr.flavor = FL_VARIABLE; + strides->attr.dimension = 1; + strides->attr.artificial = 1; + strides->as = gfc_get_array_spec(); + strides->attr.intent = INTENT_INOUT; + strides->as->type = AS_EXPLICIT; + strides->as->rank = 1; + strides->as->lower[0] = gfc_get_int_expr (gfc_index_integer_kind, NULL, 1); + strides->as->upper[0] = gfc_copy_expr (rank); + gfc_set_sym_referenced (strides); + gfc_commit_symbol (strides); + /* Set return value to 0. */ last_code = XCNEW (gfc_code); @@ -1466,6 +1744,206 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, last_code->expr2 = gfc_get_int_expr (4, NULL, 0); sub_ns->code = last_code; + /* Set: is_contiguous = .true. */ + last_code->next = XCNEW (gfc_code); + last_code = last_code->next; + last_code->op = EXEC_ASSIGN; + last_code->loc = gfc_current_locus; + last_code->expr1 = gfc_lval_expr_from_sym (is_contiguous); + last_code->expr2 = gfc_get_logical_expr (gfc_default_logical_kind, + &gfc_current_locus, true); + + /* Set: sizes(0) = 1. */ + last_code->next = XCNEW (gfc_code); + last_code = last_code->next; + last_code->op = EXEC_ASSIGN; + last_code->loc = gfc_current_locus; + last_code->expr1 = gfc_lval_expr_from_sym (sizes); + last_code->expr1->ref = gfc_get_ref (); + last_code->expr1->ref->type = REF_ARRAY; + last_code->expr1->ref->u.ar.type = AR_ELEMENT; + last_code->expr1->ref->u.ar.dimen = 1; + last_code->expr1->ref->u.ar.dimen_type[0] = DIMEN_ELEMENT; + last_code->expr1->ref->u.ar.start[0] + = gfc_get_int_expr (gfc_index_integer_kind, NULL, 0); + last_code->expr1->ref->u.ar.as = sizes->as; + last_code->expr2 = gfc_get_int_expr (gfc_default_integer_kind, NULL, 1); + + /* Create: + DO idx = 1, rank + strides(idx) = _F._stride (array, dim=idx) + sizes(idx) = sizes(i-1) * size(array, dim=idx, kind=index_kind) + if (strides(idx) /= sizes(i-1)) is_contiguous = .false. + END DO. */ + + /* Create loop. */ + iter = gfc_get_iterator (); + iter->var = gfc_lval_expr_from_sym (idx); + iter->start = gfc_get_int_expr (gfc_index_integer_kind, NULL, 1); + iter->end = gfc_copy_expr (rank); + iter->step = gfc_get_int_expr (gfc_index_integer_kind, NULL, 1); + last_code->next = XCNEW (gfc_code); + last_code = last_code->next; + last_code->op = EXEC_DO; + last_code->loc = gfc_current_locus; + last_code->ext.iterator = iter; + last_code->block = gfc_get_code (); + last_code->block->op = EXEC_DO; + + /* strides(idx) = _F._stride(array,dim=idx). */ + last_code->block->next = XCNEW (gfc_code); + block = last_code->block->next; + block->op = EXEC_ASSIGN; + block->loc = gfc_current_locus; + + block->expr1 = gfc_lval_expr_from_sym (strides); + block->expr1->ref = gfc_get_ref (); + block->expr1->ref->type = REF_ARRAY; + block->expr1->ref->u.ar.type = AR_ELEMENT; + block->expr1->ref->u.ar.dimen = 1; + block->expr1->ref->u.ar.dimen_type[0] = DIMEN_ELEMENT; + block->expr1->ref->u.ar.start[0] = gfc_lval_expr_from_sym (idx); + block->expr1->ref->u.ar.as = strides->as; + + block->expr2 = gfc_get_expr (); + block->expr2->expr_type = EXPR_FUNCTION; + block->expr2->value.function.isym + = gfc_intrinsic_function_by_id (GFC_ISYM_STRIDE); + gfc_get_sym_tree (GFC_PREFIX ("stride"), sub_ns, + &block->expr2->symtree, false); + block->expr2->symtree->n.sym->intmod_sym_id = GFC_ISYM_STRIDE; + block->expr2->symtree->n.sym->attr.flavor = FL_PROCEDURE; + block->expr2->symtree->n.sym->attr.intrinsic = 1; + gfc_commit_symbol (block->expr2->symtree->n.sym); + block->expr2->value.function.actual = gfc_get_actual_arglist (); + block->expr2->value.function.actual->expr = gfc_lval_expr_from_sym (array); + /* dim=idx. */ + block->expr2->value.function.actual->next = gfc_get_actual_arglist (); + block->expr2->value.function.actual->next->expr + = gfc_lval_expr_from_sym (idx); + block->expr2->ts = block->expr2->value.function.isym->ts; + + /* sizes(idx) = sizes(idx-1) * size(array,dim=idx, kind=index_kind). */ + block->next = XCNEW (gfc_code); + block = block->next; + block->op = EXEC_ASSIGN; + block->loc = gfc_current_locus; + + /* sizes(idx) = ... */ + block->expr1 = gfc_lval_expr_from_sym (sizes); + block->expr1->ref = gfc_get_ref (); + block->expr1->ref->type = REF_ARRAY; + block->expr1->ref->u.ar.type = AR_ELEMENT; + block->expr1->ref->u.ar.dimen = 1; + block->expr1->ref->u.ar.dimen_type[0] = DIMEN_ELEMENT; + block->expr1->ref->u.ar.start[0] = gfc_lval_expr_from_sym (idx); + block->expr1->ref->u.ar.as = sizes->as; + + block->expr2 = gfc_get_expr (); + block->expr2->expr_type = EXPR_OP; + block->expr2->value.op.op = INTRINSIC_TIMES; + + /* sizes(idx-1). */ + block->expr2->value.op.op1 = gfc_lval_expr_from_sym (sizes); + block->expr2->value.op.op1->ref = gfc_get_ref (); + block->expr2->value.op.op1->ref->type = REF_ARRAY; + block->expr2->value.op.op1->ref->u.ar.as = sizes->as; + block->expr2->value.op.op1->ref->u.ar.type = AR_ELEMENT; + block->expr2->value.op.op1->ref->u.ar.dimen = 1; + block->expr2->value.op.op1->ref->u.ar.dimen_type[0] = DIMEN_ELEMENT; + block->expr2->value.op.op1->ref->u.ar.start[0] = gfc_get_expr (); + block->expr2->value.op.op1->ref->u.ar.start[0]->expr_type = EXPR_OP; + block->expr2->value.op.op1->ref->u.ar.start[0]->value.op.op = INTRINSIC_MINUS; + block->expr2->value.op.op1->ref->u.ar.start[0]->value.op.op1 + = gfc_lval_expr_from_sym (idx); + block->expr2->value.op.op1->ref->u.ar.start[0]->value.op.op2 + = gfc_get_int_expr (gfc_index_integer_kind, NULL, 1); + block->expr2->value.op.op1->ref->u.ar.start[0]->ts + = block->expr2->value.op.op1->ref->u.ar.start[0]->value.op.op1->ts; + + /* size(array, dim=idx, kind=index_kind). */ + block->expr2->value.op.op2 = gfc_get_expr (); + block->expr2->value.op.op2->expr_type = EXPR_FUNCTION; + block->expr2->value.op.op2->value.function.isym + = gfc_intrinsic_function_by_id (GFC_ISYM_SIZE); + gfc_get_sym_tree ("size", sub_ns, &block->expr2->value.op.op2->symtree, + false); + size_intr = block->expr2->value.op.op2->symtree; + block->expr2->value.op.op2->symtree->n.sym->intmod_sym_id = GFC_ISYM_SIZE; + block->expr2->value.op.op2->symtree->n.sym->attr.flavor = FL_PROCEDURE; + block->expr2->value.op.op2->symtree->n.sym->attr.intrinsic = 1; + gfc_commit_symbol (block->expr2->value.op.op2->symtree->n.sym); + block->expr2->value.op.op2->value.function.actual + = gfc_get_actual_arglist (); + block->expr2->value.op.op2->value.function.actual->expr + = gfc_lval_expr_from_sym (array); + /* dim=idx. */ + block->expr2->value.op.op2->value.function.actual->next + = gfc_get_actual_arglist (); + block->expr2->value.op.op2->value.function.actual->next->expr + = gfc_lval_expr_from_sym (idx); + /* kind=c_intptr_t. */ + block->expr2->value.op.op2->value.function.actual->next->next + = gfc_get_actual_arglist (); + block->expr2->value.op.op2->value.function.actual->next->next->expr + = gfc_get_int_expr (gfc_index_integer_kind, NULL, 0); + block->expr2->value.op.op2->ts = idx->ts; + block->expr2->ts = idx->ts; + + /* if (strides(idx) /= sizes(idx-1)) is_contiguous = .false. */ + block->next = XCNEW (gfc_code); + block = block->next; + block->loc = gfc_current_locus; + block->op = EXEC_IF; + + block->block = XCNEW (gfc_code); + block = block->block; + block->loc = gfc_current_locus; + block->op = EXEC_IF; + + /* if condition: strides(idx) /= sizes(idx-1). */ + block->expr1 = gfc_get_expr (); + block->expr1->ts.type = BT_LOGICAL; + block->expr1->ts.kind = gfc_default_logical_kind; + block->expr1->expr_type = EXPR_OP; + block->expr1->where = gfc_current_locus; + block->expr1->value.op.op = INTRINSIC_NE; + + block->expr1->value.op.op1 = gfc_lval_expr_from_sym (strides); + block->expr1->value.op.op1->ref = gfc_get_ref (); + block->expr1->value.op.op1->ref->type = REF_ARRAY; + block->expr1->value.op.op1->ref->u.ar.type = AR_ELEMENT; + block->expr1->value.op.op1->ref->u.ar.dimen = 1; + block->expr1->value.op.op1->ref->u.ar.dimen_type[0] = DIMEN_ELEMENT; + block->expr1->value.op.op1->ref->u.ar.start[0] = gfc_lval_expr_from_sym (idx); + block->expr1->value.op.op1->ref->u.ar.as = strides->as; + + block->expr1->value.op.op2 = gfc_lval_expr_from_sym (sizes); + block->expr1->value.op.op2->ref = gfc_get_ref (); + block->expr1->value.op.op2->ref->type = REF_ARRAY; + block->expr1->value.op.op2->ref->u.ar.as = sizes->as; + block->expr1->value.op.op2->ref->u.ar.type = AR_ELEMENT; + block->expr1->value.op.op2->ref->u.ar.dimen = 1; + block->expr1->value.op.op2->ref->u.ar.dimen_type[0] = DIMEN_ELEMENT; + block->expr1->value.op.op2->ref->u.ar.start[0] = gfc_get_expr (); + block->expr1->value.op.op2->ref->u.ar.start[0]->expr_type = EXPR_OP; + block->expr1->value.op.op2->ref->u.ar.start[0]->value.op.op = INTRINSIC_MINUS; + block->expr1->value.op.op2->ref->u.ar.start[0]->value.op.op1 + = gfc_lval_expr_from_sym (idx); + block->expr1->value.op.op2->ref->u.ar.start[0]->value.op.op2 + = gfc_get_int_expr (gfc_index_integer_kind, NULL, 1); + block->expr1->value.op.op2->ref->u.ar.start[0]->ts + = block->expr1->value.op.op2->ref->u.ar.start[0]->value.op.op1->ts; + + /* if body: is_contiguous = .false. */ + block->next = XCNEW (gfc_code); + block = block->next; + block->op = EXEC_ASSIGN; + block->loc = gfc_current_locus; + block->expr1 = gfc_lval_expr_from_sym (is_contiguous); + block->expr2 = gfc_get_logical_expr (gfc_default_logical_kind, + &gfc_current_locus, false); + /* Obtain the size (number of elements) of "array" MINUS ONE, which is used in the scalarization. */ gfc_get_symbol ("nelem", sub_ns, &nelem); @@ -1476,7 +1954,7 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, gfc_set_sym_referenced (nelem); gfc_commit_symbol (nelem); - /* Generate: nelem = SIZE (array) - 1. */ + /* nelem = sizes (rank) - 1. */ last_code->next = XCNEW (gfc_code); last_code = last_code->next; last_code->op = EXEC_ASSIGN; @@ -1491,32 +1969,14 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, = gfc_get_int_expr (gfc_index_integer_kind, NULL, 1); last_code->expr2->ts = last_code->expr2->value.op.op2->ts; - last_code->expr2->value.op.op1 = gfc_get_expr (); - last_code->expr2->value.op.op1->expr_type = EXPR_FUNCTION; - last_code->expr2->value.op.op1->value.function.isym - = gfc_intrinsic_function_by_id (GFC_ISYM_SIZE); - gfc_get_sym_tree ("size", sub_ns, &last_code->expr2->value.op.op1->symtree, - false); - size_intr = last_code->expr2->value.op.op1->symtree; - last_code->expr2->value.op.op1->symtree->n.sym->attr.flavor = FL_PROCEDURE; - last_code->expr2->value.op.op1->symtree->n.sym->attr.intrinsic = 1; - gfc_commit_symbol (last_code->expr2->value.op.op1->symtree->n.sym); - last_code->expr2->value.op.op1->value.function.actual - = gfc_get_actual_arglist (); - last_code->expr2->value.op.op1->value.function.actual->expr - = gfc_lval_expr_from_sym (array); - /* dim=NULL. */ - last_code->expr2->value.op.op1->value.function.actual->next - = gfc_get_actual_arglist (); - /* kind=c_intptr_t. */ - last_code->expr2->value.op.op1->value.function.actual->next->next - = gfc_get_actual_arglist (); - last_code->expr2->value.op.op1->value.function.actual->next->next->expr - = gfc_get_int_expr (gfc_index_integer_kind, NULL, 0); - last_code->expr2->value.op.op1->ts - = last_code->expr2->value.op.op1->value.function.isym->ts; - - sub_ns->code = last_code; + last_code->expr2->value.op.op1 = gfc_lval_expr_from_sym (sizes); + last_code->expr2->value.op.op1->ref = gfc_get_ref (); + last_code->expr2->value.op.op1->ref->type = REF_ARRAY; + last_code->expr2->value.op.op1->ref->u.ar.type = AR_ELEMENT; + last_code->expr2->value.op.op1->ref->u.ar.dimen = 1; + last_code->expr2->value.op.op1->ref->u.ar.dimen_type[0] = DIMEN_ELEMENT; + last_code->expr2->value.op.op1->ref->u.ar.start[0] = gfc_copy_expr (rank); + last_code->expr2->value.op.op1->ref->u.ar.as = sizes->as; /* Call final subroutines. We now generate code like: use iso_c_binding @@ -1539,15 +1999,6 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, if (derived->f2k_derived && derived->f2k_derived->finalizers) { gfc_finalizer *fini, *fini_elem = NULL; - gfc_code *block = NULL; - - gfc_get_symbol ("idx", sub_ns, &idx); - idx->ts.type = BT_INTEGER; - idx->ts.kind = gfc_index_integer_kind; - idx->attr.flavor = FL_VARIABLE; - idx->attr.artificial = 1; - gfc_set_sym_referenced (idx); - gfc_commit_symbol (idx); gfc_get_symbol ("ptr", sub_ns, &ptr); ptr->ts.type = BT_DERIVED; @@ -1563,20 +2014,8 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, last_code = last_code->next; last_code->op = EXEC_SELECT; last_code->loc = gfc_current_locus; - - last_code->expr1 = gfc_get_expr (); - last_code->expr1->expr_type = EXPR_FUNCTION; - last_code->expr1->value.function.isym - = gfc_intrinsic_function_by_id (GFC_ISYM_RANK); - gfc_get_sym_tree ("rank", sub_ns, &last_code->expr1->symtree, - false); - last_code->expr1->symtree->n.sym->attr.flavor = FL_PROCEDURE; - last_code->expr1->symtree->n.sym->attr.intrinsic = 1; - gfc_commit_symbol (last_code->expr1->symtree->n.sym); - last_code->expr1->value.function.actual = gfc_get_actual_arglist (); - last_code->expr1->value.function.actual->expr - = gfc_lval_expr_from_sym (array); - last_code->expr1->ts = last_code->expr1->value.function.isym->ts; + last_code->expr1 = gfc_copy_expr (rank); + block = NULL; for (fini = derived->f2k_derived->finalizers; fini; fini = fini->next) { @@ -1613,8 +2052,10 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, /* CALL fini_rank (array) - possibly with packing. */ if (fini->proc_tree->n.sym->formal->sym->attr.dimension) - finalizer_insert_packed_call (block, fini, array, stride, idx, ptr, - nelem, size_intr, sub_ns); + finalizer_insert_packed_call (block, fini, array, byte_stride, + idx, ptr, nelem, size_intr, strides, + sizes, idx2, offset, is_contiguous, + rank, sub_ns); else { block->next = XCNEW (gfc_code); @@ -1630,8 +2071,6 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, /* Elemental call - scalarized. */ if (fini_elem) { - gfc_iterator *iter; - /* CASE DEFAULT. */ if (block) { @@ -1661,14 +2100,19 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, block->block = gfc_get_code (); block->block->op = EXEC_DO; + /* Offset calculation. */ + block = finalization_get_offset (idx, idx2, offset, strides, sizes, + byte_stride, rank, block->block, + sub_ns); + /* Create code for CALL C_F_POINTER (TRANSFER (TRANSFER (C_LOC (array, cptr), c_intptr) - + idx * stride, c_ptr), ptr). */ - block->block->next - = finalization_scalarizer (idx, array, ptr, - gfc_lval_expr_from_sym (stride), - sub_ns); - block = block->block->next; + + offset, c_ptr), ptr). */ + block->next + = finalization_scalarizer (array, ptr, + gfc_lval_expr_from_sym (offset), + sub_ns); + block = block->next; /* CALL final_elemental (array). */ block->next = XCNEW (gfc_code); @@ -1689,18 +2133,6 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, { gfc_symbol *stat; gfc_code *block = NULL; - gfc_iterator *iter; - - if (!idx) - { - gfc_get_symbol ("idx", sub_ns, &idx); - idx->ts.type = BT_INTEGER; - idx->ts.kind = gfc_index_integer_kind; - idx->attr.flavor = FL_VARIABLE; - idx->attr.artificial = 1; - gfc_set_sym_referenced (idx); - gfc_commit_symbol (idx); - } if (!ptr) { @@ -1736,14 +2168,18 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, last_code->block = gfc_get_code (); last_code->block->op = EXEC_DO; + /* Offset calculation. */ + block = finalization_get_offset (idx, idx2, offset, strides, sizes, + byte_stride, rank, last_code->block, + sub_ns); + /* Create code for CALL C_F_POINTER (TRANSFER (TRANSFER (C_LOC (array, cptr), c_intptr) + idx * stride, c_ptr), ptr). */ - last_code->block->next - = finalization_scalarizer (idx, array, ptr, - gfc_lval_expr_from_sym (stride), - sub_ns); - block = last_code->block->next; + block->next = finalization_scalarizer (array, ptr, + gfc_lval_expr_from_sym(offset), + sub_ns); + block = block->next; for (comp = derived->components; comp; comp = comp->next) { @@ -1772,12 +2208,13 @@ generate_finalization_wrapper (gfc_symbol *derived, gfc_namespace *ns, last_code->ext.actual = gfc_get_actual_arglist (); last_code->ext.actual->expr = gfc_lval_expr_from_sym (array); last_code->ext.actual->next = gfc_get_actual_arglist (); - last_code->ext.actual->next->expr = gfc_lval_expr_from_sym (stride); + last_code->ext.actual->next->expr = gfc_lval_expr_from_sym (byte_stride); last_code->ext.actual->next->next = gfc_get_actual_arglist (); last_code->ext.actual->next->next->expr = gfc_lval_expr_from_sym (fini_coarray); } + gfc_free_expr (rank); vtab_final->initializer = gfc_lval_expr_from_sym (final); vtab_final->ts.interface = final; } @@ -2224,9 +2661,7 @@ gfc_find_intrinsic_vtab (gfc_typespec *ts) goto cleanup; c->attr.pointer = 1; c->attr.access = ACCESS_PRIVATE; - /* Avoid segfaults because due to character length. */ - c->ts.type = ts->type == BT_CHARACTER ? BT_VOID : ts->type; - c->ts.kind = ts->kind; + c->ts.type = BT_VOID; c->initializer = gfc_get_null_expr (NULL); /* Add component _def_init. */ @@ -2234,9 +2669,7 @@ gfc_find_intrinsic_vtab (gfc_typespec *ts) goto cleanup; c->attr.pointer = 1; c->attr.access = ACCESS_PRIVATE; - /* Avoid segfaults due to missing character length. */ - c->ts.type = ts->type == BT_CHARACTER ? BT_VOID : ts->type; - c->ts.kind = ts->kind; + c->ts.type = BT_VOID; c->initializer = gfc_get_null_expr (NULL); /* Add component _copy. */ @@ -2310,6 +2743,15 @@ gfc_find_intrinsic_vtab (gfc_typespec *ts) /* Set initializer. */ c->initializer = gfc_lval_expr_from_sym (copy); c->ts.interface = copy; + + /* Add component _final. */ + if (gfc_add_component (vtype, "_final", &c) == FAILURE) + goto cleanup; + c->attr.proc_pointer = 1; + c->attr.access = ACCESS_PRIVATE; + c->tb = XCNEW (gfc_typebound_proc); + c->tb->ppc = 1; + c->initializer = gfc_get_null_expr (NULL); } vtab->ts.u.derived = vtype; vtab->value = gfc_default_initializer (&vtab->ts); diff --git a/gcc/fortran/constructor.c b/gcc/fortran/constructor.c index 182d00d165d..1392e038fc1 100644 --- a/gcc/fortran/constructor.c +++ b/gcc/fortran/constructor.c @@ -1,5 +1,5 @@ /* Array and structure constructors - Copyright (C) 2009, 2010, 2011 + Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/fortran/cpp.c b/gcc/fortran/cpp.c index f54ba96cfdf..d2ca720427a 100644 --- a/gcc/fortran/cpp.c +++ b/gcc/fortran/cpp.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. +/* Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/fortran/data.c b/gcc/fortran/data.c index de8c0ca8f5c..6df7c417223 100644 --- a/gcc/fortran/data.c +++ b/gcc/fortran/data.c @@ -1,6 +1,6 @@ /* Supporting functions for resolving DATA statement. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 - Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, + 2012 Free Software Foundation, Inc. Contributed by Lifang Zeng <zlf605@hotmail.com> This file is part of GCC. diff --git a/gcc/fortran/decl.c b/gcc/fortran/decl.c index 5ed838856a9..2e6e98a1ada 100644 --- a/gcc/fortran/decl.c +++ b/gcc/fortran/decl.c @@ -1,5 +1,6 @@ /* Declaration statement matcher - Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 + Copyright (C) 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, + 2012, 2013 Free Software Foundation, Inc. Contributed by Andy Vaught @@ -1671,11 +1672,31 @@ match gfc_match_null (gfc_expr **result) { gfc_symbol *sym; - match m; + match m, m2 = MATCH_NO; - m = gfc_match (" null ( )"); - if (m != MATCH_YES) - return m; + if ((m = gfc_match (" null ( )")) == MATCH_ERROR) + return MATCH_ERROR; + + if (m == MATCH_NO) + { + locus old_loc; + char name[GFC_MAX_SYMBOL_LEN + 1]; + + if ((m2 = gfc_match (" null (")) != MATCH_YES) + return m2; + + old_loc = gfc_current_locus; + if ((m2 = gfc_match (" %n ) ", name)) == MATCH_ERROR) + return MATCH_ERROR; + if (m2 != MATCH_YES + && ((m2 = gfc_match (" mold = %n )", name)) == MATCH_ERROR)) + return MATCH_ERROR; + if (m2 == MATCH_NO) + { + gfc_current_locus = old_loc; + return MATCH_NO; + } + } /* The NULL symbol now has to be/become an intrinsic function. */ if (gfc_get_symbol ("null", NULL, &sym)) @@ -1694,6 +1715,13 @@ gfc_match_null (gfc_expr **result) *result = gfc_get_null_expr (&gfc_current_locus); + /* Invalid per F2008, C512. */ + if (m2 == MATCH_YES) + { + gfc_error ("NULL() initialization at %C may not have MOLD"); + return MATCH_ERROR; + } + return MATCH_YES; } diff --git a/gcc/fortran/dependency.c b/gcc/fortran/dependency.c index 7c9525ac805..c8b54f111d5 100644 --- a/gcc/fortran/dependency.c +++ b/gcc/fortran/dependency.c @@ -1,6 +1,6 @@ /* Dependency analysis - Copyright (C) 2000, 2001, 2002, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011, + 2012 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> This file is part of GCC. diff --git a/gcc/fortran/dependency.h b/gcc/fortran/dependency.h index d56a7f726d2..b026869cdee 100644 --- a/gcc/fortran/dependency.h +++ b/gcc/fortran/dependency.h @@ -1,6 +1,6 @@ /* Header for dependency analysis - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010 - Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, + 2011 Free Software Foundation, Inc. Contributed by Paul Brook This file is part of GCC. diff --git a/gcc/fortran/dump-parse-tree.c b/gcc/fortran/dump-parse-tree.c index a442625cb8a..e1ae7758a60 100644 --- a/gcc/fortran/dump-parse-tree.c +++ b/gcc/fortran/dump-parse-tree.c @@ -1,5 +1,5 @@ /* Parse tree dumper - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Steven Bosscher diff --git a/gcc/fortran/error.c b/gcc/fortran/error.c index 611540c261a..8e14bbe7344 100644 --- a/gcc/fortran/error.c +++ b/gcc/fortran/error.c @@ -1,6 +1,6 @@ /* Handle errors. Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2010 + 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Andy Vaught & Niels Kristian Bech Jensen diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index 5c9ce11c4ee..261078460d2 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3151,9 +3151,8 @@ gfc_check_assign (gfc_expr *lvalue, gfc_expr *rvalue, int conform) /* This is possibly a typo: x = f() instead of x => f(). */ if (gfc_option.warn_surprising - && rvalue->expr_type == EXPR_FUNCTION - && rvalue->symtree->n.sym->attr.pointer) - gfc_warning ("POINTER valued function appears on right-hand side of " + && rvalue->expr_type == EXPR_FUNCTION && gfc_expr_attr (rvalue).pointer) + gfc_warning ("POINTER-valued function appears on right-hand side of " "assignment at %L", &rvalue->where); /* Check size of array assignments. */ diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index be0d99f9c12..e72581b5b4e 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -1,6 +1,6 @@ /* gfortran backend interface Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2010, 2012 + 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Paul Brook. diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index a419af3ad40..027cab6b356 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -521,6 +521,7 @@ enum gfc_isym_id GFC_ISYM_SR_KIND, GFC_ISYM_STAT, GFC_ISYM_STORAGE_SIZE, + GFC_ISYM_STRIDE, GFC_ISYM_SUM, GFC_ISYM_SYMLINK, GFC_ISYM_SYMLNK, diff --git a/gcc/fortran/gfortranspec.c b/gcc/fortran/gfortranspec.c index 2240bfb9985..cce53a9fd2c 100644 --- a/gcc/fortran/gfortranspec.c +++ b/gcc/fortran/gfortranspec.c @@ -1,6 +1,6 @@ /* Specific flags and argument handling of the Fortran front-end. Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, - 2007, 2008, 2009, 2010, 2011, 2012 + 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. This file is part of GCC. @@ -301,7 +301,7 @@ lang_specific_driver (struct cl_decoded_option **in_decoded_options, case OPT__version: printf ("GNU Fortran %s%s\n", pkgversion_string, version_string); - printf ("Copyright %s 2012 Free Software Foundation, Inc.\n\n", + printf ("Copyright %s 2013 Free Software Foundation, Inc.\n\n", _("(C)")); printf (_("GNU Fortran comes with NO WARRANTY, to the extent permitted by law.\n\ You may redistribute copies of GNU Fortran\n\ diff --git a/gcc/fortran/intrinsic.c b/gcc/fortran/intrinsic.c index 274c921c8a8..5f1b8e7f5a2 100644 --- a/gcc/fortran/intrinsic.c +++ b/gcc/fortran/intrinsic.c @@ -1,7 +1,7 @@ /* Build up a list of intrinsic subroutines and functions for the name-resolution stage. Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011 + 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Andy Vaught & Katherine Holcomb @@ -2640,6 +2640,14 @@ add_functions (void) make_generic ("size", GFC_ISYM_SIZE, GFC_STD_F95); + /* Obtain the stride for a given dimensions; to be used only internally. + "make_from_module" makes inaccessible for external users. */ + add_sym_2 (GFC_PREFIX ("stride"), GFC_ISYM_STRIDE, CLASS_INQUIRY, ACTUAL_NO, + BT_INTEGER, gfc_index_integer_kind, GFC_STD_GNU, + NULL, NULL, gfc_resolve_stride, + ar, BT_REAL, dr, REQUIRED, dm, BT_INTEGER, ii, OPTIONAL); + make_from_module(); + add_sym_1 ("sizeof", GFC_ISYM_SIZEOF, CLASS_IMPURE, ACTUAL_NO, BT_INTEGER, ii, GFC_STD_GNU, gfc_check_sizeof, NULL, NULL, x, BT_UNKNOWN, 0, REQUIRED); diff --git a/gcc/fortran/intrinsic.h b/gcc/fortran/intrinsic.h index 2635ba6d3da..e7b26e5ce0e 100644 --- a/gcc/fortran/intrinsic.h +++ b/gcc/fortran/intrinsic.h @@ -1,7 +1,7 @@ /* Header file for intrinsics check, resolve and simplify function prototypes. Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010, 2011 Free Software Foundation, Inc. + 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Andy Vaught & Katherine Holcomb This file is part of GCC. @@ -546,6 +546,7 @@ void gfc_resolve_signal (gfc_expr *, gfc_expr *, gfc_expr *); void gfc_resolve_sin (gfc_expr *, gfc_expr *); void gfc_resolve_sinh (gfc_expr *, gfc_expr *); void gfc_resolve_size (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *); +void gfc_resolve_stride (gfc_expr *, gfc_expr *, gfc_expr *); void gfc_resolve_spacing (gfc_expr *, gfc_expr *); void gfc_resolve_spread (gfc_expr *, gfc_expr *, gfc_expr *, gfc_expr *); void gfc_resolve_sqrt (gfc_expr *, gfc_expr *); diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index fc256cb9e8b..e3c1aeeffcc 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -1,5 +1,5 @@ @ignore -Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2012 +Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This is part of the GNU Fortran manual. For copying conditions, see the file gfortran.texi. diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 7eb52a974d7..601a331d3d2 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -1,6 +1,6 @@ /* Deal with I/O statements & related stuff. Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011 + 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Andy Vaught diff --git a/gcc/fortran/ioparm.def b/gcc/fortran/ioparm.def index c9c271d886d..aab9f30c544 100644 --- a/gcc/fortran/ioparm.def +++ b/gcc/fortran/ioparm.def @@ -1,4 +1,4 @@ -/* Copyright (C) 2005, 2006, 2008, 2010 +/* Copyright (C) 2005, 2006, 2008, 2010, 2012 Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/fortran/iresolve.c b/gcc/fortran/iresolve.c index 3f981d88c1b..160bfe01d8b 100644 --- a/gcc/fortran/iresolve.c +++ b/gcc/fortran/iresolve.c @@ -1,6 +1,6 @@ /* Intrinsic function resolution. Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011 + 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Andy Vaught & Katherine Holcomb @@ -2314,6 +2314,15 @@ gfc_resolve_size (gfc_expr *f, gfc_expr *array ATTRIBUTE_UNUSED, void +gfc_resolve_stride (gfc_expr *f, gfc_expr *array ATTRIBUTE_UNUSED, + gfc_expr *dim ATTRIBUTE_UNUSED) +{ + f->ts.type = BT_INTEGER; + f->ts.kind = gfc_index_integer_kind; +} + + +void gfc_resolve_spacing (gfc_expr *f, gfc_expr *x) { f->ts = x->ts; diff --git a/gcc/fortran/iso-c-binding.def b/gcc/fortran/iso-c-binding.def index 66712ad0d30..99c7e0cacba 100644 --- a/gcc/fortran/iso-c-binding.def +++ b/gcc/fortran/iso-c-binding.def @@ -1,4 +1,5 @@ -/* Copyright (C) 2006, 2007, 2008, 2010 Free Software Foundation, Inc. +/* Copyright (C) 2006, 2007, 2008, 2010, 2011, 2012 + Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/fortran/iso-fortran-env.def b/gcc/fortran/iso-fortran-env.def index 240a02218ab..5129f2add43 100644 --- a/gcc/fortran/iso-fortran-env.def +++ b/gcc/fortran/iso-fortran-env.def @@ -1,4 +1,5 @@ -/* Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +/* Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 + Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index ca8f08c6822..2a3f5b4c0d2 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -1,6 +1,6 @@ /* Matching subroutines in all sizes, shapes and colors. Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, - 2009, 2010, 2011, 2012 + 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. Contributed by Andy Vaught @@ -5144,12 +5144,10 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector) { gfc_ref *ref; gfc_symbol *assoc_sym; + int i; assoc_sym = associate->symtree->n.sym; - /* Ensure that any array reference is resolved. */ - gfc_resolve_expr (selector); - /* At this stage the expression rank and arrayspec dimensions have not been completely sorted out. We must get the expr2->rank right here, so that the correct class container is obtained. */ @@ -5161,6 +5159,23 @@ copy_ts_from_selector_to_associate (gfc_expr *associate, gfc_expr *selector) && CLASS_DATA (selector)->as && ref && ref->type == REF_ARRAY) { + /* Ensure that the array reference type is set. We cannot use + gfc_resolve_expr at this point, so the usable parts of + resolve.c(resolve_array_ref) are employed to do it. */ + if (ref->u.ar.type == AR_UNKNOWN) + { + ref->u.ar.type = AR_ELEMENT; + for (i = 0; i < ref->u.ar.dimen + ref->u.ar.codimen; i++) + if (ref->u.ar.dimen_type[i] == DIMEN_RANGE + || ref->u.ar.dimen_type[i] == DIMEN_VECTOR + || (ref->u.ar.dimen_type[i] == DIMEN_UNKNOWN + && ref->u.ar.start[i] && ref->u.ar.start[i]->rank)) + { + ref->u.ar.type = AR_SECTION; + break; + } + } + if (ref->u.ar.type == AR_FULL) selector->rank = CLASS_DATA (selector)->as->rank; else if (ref->u.ar.type == AR_SECTION) diff --git a/gcc/fortran/match.h b/gcc/fortran/match.h index 029faf77e7b..6f798659941 100644 --- a/gcc/fortran/match.h +++ b/gcc/fortran/match.h @@ -1,5 +1,5 @@ /* All matcher functions. - Copyright (C) 2003, 2005, 2007, 2008, 2010, 2012 + Copyright (C) 2003, 2005, 2007, 2008, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Steven Bosscher diff --git a/gcc/fortran/matchexp.c b/gcc/fortran/matchexp.c index c1196a8802c..14edbcedf5e 100644 --- a/gcc/fortran/matchexp.c +++ b/gcc/fortran/matchexp.c @@ -1,6 +1,6 @@ /* Expression parser. - Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, + 2011, 2012 Free Software Foundation, Inc. Contributed by Andy Vaught This file is part of GCC. diff --git a/gcc/fortran/mathbuiltins.def b/gcc/fortran/mathbuiltins.def index b3998568b5f..d63b39b9375 100644 --- a/gcc/fortran/mathbuiltins.def +++ b/gcc/fortran/mathbuiltins.def @@ -1,4 +1,5 @@ -/* Copyright (C) 2004, 2005, 2007, 2008, 2010 Free Software Foundation, Inc. +/* Copyright (C) 2004, 2005, 2007, 2008, 2010, 2012 + Free Software Foundation, Inc. This file is part of GCC. diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index e19c6d9d71f..f3b3caa1ad8 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -4663,8 +4663,14 @@ read_module (void) if (p == NULL) { st = gfc_find_symtree (gfc_current_ns->sym_root, name); - if (st != NULL) - info->u.rsym.symtree = st; + if (st != NULL + && strcmp (st->n.sym->name, info->u.rsym.true_name) == 0 + && st->n.sym->module != NULL + && strcmp (st->n.sym->module, info->u.rsym.module) == 0) + { + info->u.rsym.symtree = st; + info->u.rsym.sym = st->n.sym; + } continue; } @@ -4685,7 +4691,8 @@ read_module (void) /* Check for ambiguous symbols. */ if (check_for_ambiguous (st->n.sym, info)) st->ambiguous = 1; - info->u.rsym.symtree = st; + else + info->u.rsym.symtree = st; } else { diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index e1ffa6b49f7..b473b4e1876 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -1,5 +1,5 @@ /* OpenMP directive matching and resolving. - Copyright (C) 2005, 2006, 2007, 2008, 2010, 2011 + Copyright (C) 2005, 2006, 2007, 2008, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Jakub Jelinek diff --git a/gcc/fortran/parse.h b/gcc/fortran/parse.h index 9e56b81dc86..b1baa1d1f2c 100644 --- a/gcc/fortran/parse.h +++ b/gcc/fortran/parse.h @@ -1,5 +1,5 @@ /* Parser header - Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Steven Bosscher diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 873400abb39..b81f2319aa6 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -1,6 +1,6 @@ /* Perform type resolution on the various structures. Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010, 2011, 2012 + 2010, 2011, 2012, 2013 Free Software Foundation, Inc. Contributed by Andy Vaught @@ -3776,7 +3776,7 @@ resolve_call (gfc_code *c) if (csym && gfc_current_ns->parent && csym->ns != gfc_current_ns) { gfc_symtree *st; - gfc_find_sym_tree (csym->name, gfc_current_ns, 1, &st); + gfc_find_sym_tree (c->symtree->name, gfc_current_ns, 1, &st); sym = st ? st->n.sym : NULL; if (sym && csym != sym && sym->ns == gfc_current_ns @@ -8349,9 +8349,27 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns) if (code->expr1->symtree->n.sym->attr.untyped) code->expr1->symtree->n.sym->ts = code->expr2->ts; selector_type = CLASS_DATA (code->expr2)->ts.u.derived; + + /* F2008: C803 The selector expression must not be coindexed. */ + if (gfc_is_coindexed (code->expr2)) + { + gfc_error ("Selector at %L must not be coindexed", + &code->expr2->where); + return; + } + } else - selector_type = CLASS_DATA (code->expr1)->ts.u.derived; + { + selector_type = CLASS_DATA (code->expr1)->ts.u.derived; + + if (gfc_is_coindexed (code->expr1)) + { + gfc_error ("Selector at %L must not be coindexed", + &code->expr1->where); + return; + } + } /* Loop over TYPE IS / CLASS IS cases. */ for (body = code->block; body; body = body->block) diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index 765c0f97705..716c0874f01 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -1,6 +1,6 @@ /* Character scanner. Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010 Free Software Foundation, Inc. + 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Andy Vaught This file is part of GCC. diff --git a/gcc/fortran/st.c b/gcc/fortran/st.c index ed379fc44af..56e03610c79 100644 --- a/gcc/fortran/st.c +++ b/gcc/fortran/st.c @@ -1,6 +1,6 @@ /* Build executable statement trees. - Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2007, 2008, 2009, 2010, + 2011, 2012 Free Software Foundation, Inc. Contributed by Andy Vaught This file is part of GCC. diff --git a/gcc/fortran/target-memory.c b/gcc/fortran/target-memory.c index 437a3df8304..89db559ac87 100644 --- a/gcc/fortran/target-memory.c +++ b/gcc/fortran/target-memory.c @@ -1,5 +1,5 @@ /* Simulate storage of variables into target memory. - Copyright (C) 2007, 2008, 2009, 2010 + Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Paul Thomas and Brooks Moses diff --git a/gcc/fortran/target-memory.h b/gcc/fortran/target-memory.h index cba2ea2d348..1f4e2fc7b8a 100644 --- a/gcc/fortran/target-memory.h +++ b/gcc/fortran/target-memory.h @@ -1,5 +1,5 @@ /* Simulate storage of variables into target memory, header. - Copyright (C) 2007, 2008, 2010 + Copyright (C) 2007, 2008, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Paul Thomas and Brooks Moses diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 06898920369..794322ac79a 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1,6 +1,6 @@ /* Array translation routines Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, - 2011, 2012 + 2011, 2012, 2013 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> and Steven Bosscher <s.bosscher@student.tudelft.nl> @@ -159,7 +159,7 @@ gfc_conv_descriptor_data_get (tree desc) /* This provides WRITE access to the data field. TUPLES_P is true if we are generating tuples. - + This function gets called through the following macros: gfc_conv_descriptor_data_set gfc_conv_descriptor_data_set. */ @@ -593,7 +593,7 @@ gfc_get_temp_ss (tree type, tree string_length, int dimen) return ss; } - + /* Creates and initializes a scalar type gfc_ss struct. */ @@ -1363,7 +1363,7 @@ gfc_put_offset_into_var (stmtblock_t * pblock, tree * poffset, /* Variables needed for bounds-checking. */ static bool first_len; -static tree first_len_val; +static tree first_len_val; static bool typespec_chararray_ctor; static void @@ -2206,7 +2206,7 @@ trans_array_constructor (gfc_ss * ss, locus * where) if ((gfc_option.rtcheck & GFC_RTCHECK_BOUNDS) && expr->ts.type == BT_CHARACTER && !typespec_chararray_ctor) - { + { first_len_val = gfc_create_var (gfc_charlen_type_node, "len"); first_len = true; } @@ -2217,7 +2217,7 @@ trans_array_constructor (gfc_ss * ss, locus * where) if (expr->ts.type == BT_CHARACTER) { bool const_string; - + /* get_array_ctor_strlen walks the elements of the constructor, if a typespec was given, we already know the string length and want the one specified there. */ @@ -2924,9 +2924,9 @@ conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i, gcc_assert (se->loop); index = se->loop->loopvar[se->loop->order[i]]; - /* Pointer functions can have stride[0] different from unity. + /* Pointer functions can have stride[0] different from unity. Use the stride returned by the function call and stored in - the descriptor for the temporary. */ + the descriptor for the temporary. */ if (se->ss && se->ss->info->type == GFC_SS_FUNCTION && se->ss->info->expr && se->ss->info->expr->symtree @@ -2986,7 +2986,7 @@ build_class_array_ref (gfc_se *se, tree base, tree index) ts = &ref->u.c.component->ts; class_ref = ref; break; - } + } } if (ts == NULL) @@ -3099,31 +3099,40 @@ static tree build_array_ref (tree desc, tree offset, tree decl) { tree tmp; + tree type; - /* Class array references need special treatment because the assigned - type size needs to be used to point to the element. */ + /* Class container types do not always have the GFC_CLASS_TYPE_P + but the canonical type does. */ if (GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (desc)) - && TREE_CODE (desc) == COMPONENT_REF - && GFC_CLASS_TYPE_P (TREE_TYPE (TREE_OPERAND (desc, 0)))) + && TREE_CODE (desc) == COMPONENT_REF) { - tree type = gfc_get_element_type (TREE_TYPE (desc)); - tmp = TREE_OPERAND (desc, 0); - tmp = gfc_get_class_array_ref (offset, tmp); - tmp = fold_convert (build_pointer_type (type), tmp); - tmp = build_fold_indirect_ref_loc (input_location, tmp); + type = TREE_TYPE (TREE_OPERAND (desc, 0)); + if (TYPE_CANONICAL (type) + && GFC_CLASS_TYPE_P (TYPE_CANONICAL (type))) + type = TYPE_CANONICAL (type); } else + type = NULL; + + /* Class array references need special treatment because the assigned + type size needs to be used to point to the element. */ + if (type && GFC_CLASS_TYPE_P (type)) { - tmp = gfc_conv_array_data (desc); + type = gfc_get_element_type (TREE_TYPE (desc)); + tmp = TREE_OPERAND (desc, 0); + tmp = gfc_get_class_array_ref (offset, tmp); + tmp = fold_convert (build_pointer_type (type), tmp); tmp = build_fold_indirect_ref_loc (input_location, tmp); - tmp = gfc_build_array_ref (tmp, offset, decl); + return tmp; } + tmp = gfc_conv_array_data (desc); + tmp = build_fold_indirect_ref_loc (input_location, tmp); + tmp = gfc_build_array_ref (tmp, offset, decl); return tmp; } - /* Build an array reference. se->expr already holds the array descriptor. This should be either a variable, indirect variable reference or component reference. For arrays which do not have a descriptor, se->expr will be @@ -3202,7 +3211,7 @@ gfc_conv_array_ref (gfc_se * se, gfc_array_ref * ar, gfc_symbol * sym, tmp = tmpse.expr; } - cond = fold_build2_loc (input_location, LT_EXPR, boolean_type_node, + cond = fold_build2_loc (input_location, LT_EXPR, boolean_type_node, indexse.expr, tmp); asprintf (&msg, "Index '%%ld' of dimension %d of array '%s' " "below lower bound of %%ld", n+1, sym->name); @@ -3964,8 +3973,8 @@ done: stride_pos, stride_neg); /* Check the start of the range against the lower and upper - bounds of the array, if the range is not empty. - If upper bound is present, include both bounds in the + bounds of the array, if the range is not empty. + If upper bound is present, include both bounds in the error message. */ if (check_upper) { @@ -4012,7 +4021,7 @@ done: fold_convert (long_integer_type_node, lbound)); free (msg); } - + /* Compute the last element of the range, which is not necessarily "end" (think 0:5:3, which doesn't contain 5) and check it against both lower and upper bounds. */ @@ -4041,12 +4050,12 @@ done: gfc_trans_runtime_check (true, false, tmp2, &inner, expr_loc, msg, fold_convert (long_integer_type_node, tmp), - fold_convert (long_integer_type_node, ubound), + fold_convert (long_integer_type_node, ubound), fold_convert (long_integer_type_node, lbound)); gfc_trans_runtime_check (true, false, tmp3, &inner, expr_loc, msg, fold_convert (long_integer_type_node, tmp), - fold_convert (long_integer_type_node, ubound), + fold_convert (long_integer_type_node, ubound), fold_convert (long_integer_type_node, lbound)); free (msg); } @@ -4885,7 +4894,7 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset, ubound = lower[n]; } } - gfc_conv_descriptor_lbound_set (descriptor_block, descriptor, + gfc_conv_descriptor_lbound_set (descriptor_block, descriptor, gfc_rank_cst[n], se.expr); conv_lbound = se.expr; @@ -4916,11 +4925,11 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset, /* Check whether multiplying the stride by the number of elements in this dimension would overflow. We must also check whether the current dimension has zero size in order to avoid - division by zero. + division by zero. */ - tmp = fold_build2_loc (input_location, TRUNC_DIV_EXPR, - gfc_array_index_type, - fold_convert (gfc_array_index_type, + tmp = fold_build2_loc (input_location, TRUNC_DIV_EXPR, + gfc_array_index_type, + fold_convert (gfc_array_index_type, TYPE_MAX_VALUE (gfc_array_index_type)), size); cond = gfc_unlikely (fold_build2_loc (input_location, LT_EXPR, @@ -4935,7 +4944,7 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset, tmp = fold_build2_loc (input_location, PLUS_EXPR, integer_type_node, *overflow, tmp); *overflow = gfc_evaluate_now (tmp, pblock); - + /* Multiply the stride by the number of elements in this dimension. */ stride = fold_build2_loc (input_location, MULT_EXPR, gfc_array_index_type, stride, size); @@ -4966,7 +4975,7 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset, ubound = lower[n]; } } - gfc_conv_descriptor_lbound_set (descriptor_block, descriptor, + gfc_conv_descriptor_lbound_set (descriptor_block, descriptor, gfc_rank_cst[n], se.expr); if (n < rank + corank - 1) @@ -5019,7 +5028,7 @@ gfc_array_init_size (tree descriptor, int rank, int corank, tree * poffset, /* First check for overflow. Since an array of type character can have zero element_size, we must check for that before dividing. */ - tmp = fold_build2_loc (input_location, TRUNC_DIV_EXPR, + tmp = fold_build2_loc (input_location, TRUNC_DIV_EXPR, size_type_node, TYPE_MAX_VALUE (size_type_node), element_size); cond = gfc_unlikely (fold_build2_loc (input_location, LT_EXPR, @@ -5210,7 +5219,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, { cond = gfc_unlikely (fold_build2_loc (input_location, NE_EXPR, boolean_type_node, var_overflow, integer_zero_node)); - tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node, cond, + tmp = fold_build3_loc (input_location, COND_EXPR, void_type_node, cond, error, gfc_finish_block (&elseblock)); } else @@ -5221,7 +5230,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, if (expr->ts.type == BT_CLASS) { tmp = build_int_cst (unsigned_char_type_node, 0); - /* With class objects, it is best to play safe and null the + /* With class objects, it is best to play safe and null the memory because we cannot know if dynamic types have allocatable components or not. */ tmp = build_call_expr_loc (input_location, @@ -5233,7 +5242,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, /* Update the array descriptors. */ if (dimension) gfc_conv_descriptor_offset_set (&set_descriptor_block, se->expr, offset); - + set_descriptor = gfc_finish_block (&set_descriptor_block); if (status != NULL_TREE) { @@ -5243,7 +5252,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree status, tree errmsg, gfc_add_expr_to_block (&se->pre, fold_build3_loc (input_location, COND_EXPR, void_type_node, gfc_likely (cond), set_descriptor, - build_empty_stmt (input_location))); + build_empty_stmt (input_location))); } else gfc_add_expr_to_block (&se->pre, set_descriptor); @@ -5331,7 +5340,7 @@ gfc_conv_array_initializer (tree type, gfc_expr * expr) /* A single scalar or derived type value. Create an array with all elements equal to that value. */ gfc_init_se (&se, NULL); - + if (expr->expr_type == EXPR_CONSTANT) gfc_conv_constant (&se, expr); else @@ -5743,7 +5752,7 @@ gfc_trans_g77_array (gfc_symbol * sym, gfc_wrapped_block * block) tmp = gfc_conv_expr_present (sym); stmt = build3_v (COND_EXPR, tmp, stmt, build_empty_stmt (input_location)); } - + gfc_add_init_cleanup (block, stmt, NULL_TREE); } @@ -5945,7 +5954,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, asprintf (&msg, "Dimension %d of array '%s' has extent " "%%ld instead of %%ld", n+1, sym->name); - gfc_trans_runtime_check (true, false, tmp, &init, &loc, msg, + gfc_trans_runtime_check (true, false, tmp, &init, &loc, msg, fold_convert (long_integer_type_node, temp), fold_convert (long_integer_type_node, stride2)); @@ -6069,7 +6078,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, gfc_add_expr_to_block (&cleanup, tmp); stmtCleanup = gfc_finish_block (&cleanup); - + /* Only do the cleanup if the array was repacked. */ tmp = build_fold_indirect_ref_loc (input_location, dumdesc); tmp = gfc_conv_descriptor_data_get (tmp); @@ -6381,7 +6390,7 @@ walk_coarray (gfc_expr *e) EXPR is the right-hand side of a pointer assignment and se->expr is the descriptor for the previously-evaluated left-hand side. The function creates an assignment from - EXPR to se->expr. + EXPR to se->expr. The se->force_tmp flag disables the non-copying descriptor optimization @@ -6495,7 +6504,7 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr) return; } break; - + case EXPR_FUNCTION: /* A transformational function return value will be a temporary array descriptor. We still need to go through the scalarizer @@ -6785,7 +6794,7 @@ gfc_conv_expr_descriptor (gfc_se *se, gfc_expr *expr) /* Vector subscripts need copying and are handled elsewhere. */ if (info->ref) gcc_assert (info->ref->u.ar.dimen_type[n] == DIMEN_RANGE); - + /* look for the corresponding scalarizer dimension: dim. */ for (dim = 0; dim < ndim; dim++) if (ss->dim[dim] == n) @@ -7011,9 +7020,9 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77, if (!sym->attr.pointer && sym->as - && sym->as->type != AS_ASSUMED_SHAPE + && sym->as->type != AS_ASSUMED_SHAPE && sym->as->type != AS_DEFERRED - && sym->as->type != AS_ASSUMED_RANK + && sym->as->type != AS_ASSUMED_RANK && !sym->attr.allocatable) { /* Some variables are declared directly, others are declared as @@ -7071,7 +7080,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77, && expr->symtree->n.sym->attr.allocatable; /* Or ultimate allocatable components. */ - ultimate_alloc_comp = contiguous && ultimate_alloc_comp; + ultimate_alloc_comp = contiguous && ultimate_alloc_comp; if (no_pack || array_constructor || good_allocatable || ultimate_alloc_comp) { @@ -7254,7 +7263,7 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, bool g77, tree gfc_trans_dealloc_allocated (tree descriptor, bool coarray) -{ +{ tree tmp; tree var; stmtblock_t block; @@ -7454,7 +7463,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, tmp = gfc_conv_array_data (decl); var = build_fold_indirect_ref_loc (input_location, tmp); - + /* Get the number of elements - 1 and set the counter. */ if (GFC_DESCRIPTOR_TYPE_P (decl_type)) { @@ -7578,7 +7587,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, /* Allocatable CLASS components. */ comp = fold_build3_loc (input_location, COMPONENT_REF, ctype, decl, cdecl, NULL_TREE); - + /* Add reference to '_data' component. */ tmp = CLASS_DATA (c)->backend_decl; comp = fold_build3_loc (input_location, COMPONENT_REF, @@ -7725,7 +7734,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, null_cond = fold_build2_loc (input_location, NE_EXPR, boolean_type_node, src_data, - null_pointer_node); + null_pointer_node); gfc_add_expr_to_block (&fnblock, build3_v (COND_EXPR, null_cond, tmp, null_data)); @@ -8030,7 +8039,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop, as = NULL; /* If the lhs shape is not the same as the rhs jump to setting the - bounds and doing the reallocation....... */ + bounds and doing the reallocation....... */ for (n = 0; n < expr1->rank; n++) { /* Check the shape. */ @@ -8051,13 +8060,13 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop, tmp = build3_v (COND_EXPR, cond, build1_v (GOTO_EXPR, jump_label1), build_empty_stmt (input_location)); - gfc_add_expr_to_block (&fblock, tmp); + gfc_add_expr_to_block (&fblock, tmp); } /* ....else jump past the (re)alloc code. */ tmp = build1_v (GOTO_EXPR, jump_label2); gfc_add_expr_to_block (&fblock, tmp); - + /* Add the label to start automatic (re)allocation. */ tmp = build1_v (LABEL_EXPR, jump_label1); gfc_add_expr_to_block (&fblock, tmp); @@ -8096,7 +8105,7 @@ gfc_alloc_allocatable_for_assignment (gfc_loopinfo *loop, unallocated allocatable variable, then it is allocated with each deferred type parameter equal to the corresponding type parameters of expr , with the shape of expr , and with each lower bound equal - to the corresponding element of LBOUND(expr)." + to the corresponding element of LBOUND(expr)." Reuse size1 to keep a dimension-by-dimension track of the stride of the new array. */ size1 = gfc_index_one_node; @@ -8340,7 +8349,7 @@ gfc_trans_deferred_array (gfc_symbol * sym, gfc_wrapped_block * block) sym->backend_decl); type = TREE_TYPE (descriptor); } - + /* NULLIFY the data pointer. */ if (GFC_DESCRIPTOR_TYPE_P (type) && !sym->attr.save) gfc_conv_descriptor_data_set (&init, descriptor, null_pointer_node); diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h index de032020261..112b46545a5 100644 --- a/gcc/fortran/trans-array.h +++ b/gcc/fortran/trans-array.h @@ -1,6 +1,6 @@ /* Header for array handling functions - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012 - Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, + 2012 Free Software Foundation, Inc. Contributed by Paul Brook This file is part of GCC. diff --git a/gcc/fortran/trans-const.c b/gcc/fortran/trans-const.c index fa820ef10de..07db00bb3bf 100644 --- a/gcc/fortran/trans-const.c +++ b/gcc/fortran/trans-const.c @@ -1,5 +1,5 @@ /* Translation of constants - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Contributed by Paul Brook diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 452f2bcf974..9452e276962 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -1,6 +1,6 @@ /* Expression translation Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, - 2011, 2012 + 2011, 2012, 2013 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> and Steven Bosscher <s.bosscher@student.tudelft.nl> @@ -61,8 +61,8 @@ get_scalar_to_descriptor_type (tree scalar, symbol_attribute attr) akind, !(attr.pointer || attr.target)); } -static tree -conv_scalar_to_descriptor (gfc_se *se, tree scalar, symbol_attribute attr) +tree +gfc_conv_scalar_to_descriptor (gfc_se *se, tree scalar, symbol_attribute attr) { tree desc, type; @@ -198,16 +198,31 @@ gfc_vtable_final_get (tree decl) #undef VTABLE_FINAL_FIELD -/* Obtain the vptr of the last class reference in an expression. */ +/* Obtain the vptr of the last class reference in an expression. + Return NULL_TREE if no class reference is found. */ tree gfc_get_vptr_from_expr (tree expr) { - tree tmp = expr; - while (tmp && !GFC_CLASS_TYPE_P (TREE_TYPE (tmp))) - tmp = TREE_OPERAND (tmp, 0); - tmp = gfc_class_vptr_get (tmp); - return tmp; + tree tmp; + tree type; + + for (tmp = expr; tmp; tmp = TREE_OPERAND (tmp, 0)) + { + type = TREE_TYPE (tmp); + while (type) + { + if (GFC_CLASS_TYPE_P (type)) + return gfc_class_vptr_get (tmp); + if (type != TYPE_CANONICAL (type)) + type = TYPE_CANONICAL (type); + else + type = NULL_TREE; + } + if (TREE_CODE (tmp) == VAR_DECL) + break; + } + return NULL_TREE; } @@ -594,7 +609,7 @@ gfc_conv_class_to_class (gfc_se *parmse, gfc_expr *e, gfc_typespec class_ts, } else { - if (CLASS_DATA (e)->attr.codimension) + if (TREE_TYPE (parmse->expr) != TREE_TYPE (ctree)) parmse->expr = fold_build1_loc (input_location, VIEW_CONVERT_EXPR, TREE_TYPE (ctree), parmse->expr); gfc_add_modify (&block, ctree, parmse->expr); @@ -1562,6 +1577,7 @@ gfc_conv_component_ref (gfc_se * se, gfc_ref * ref) c->norestrict_decl = f2; field = f2; } + tmp = fold_build3_loc (input_location, COMPONENT_REF, TREE_TYPE (field), decl, field, NULL_TREE); @@ -4355,8 +4371,8 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, if (TREE_CODE (tmp) == ADDR_EXPR && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (tmp, 0)))) tmp = TREE_OPERAND (tmp, 0); - parmse.expr = conv_scalar_to_descriptor (&parmse, tmp, - fsym->attr); + parmse.expr = gfc_conv_scalar_to_descriptor (&parmse, tmp, + fsym->attr); parmse.expr = gfc_build_addr_expr (NULL_TREE, parmse.expr); } @@ -5525,20 +5541,20 @@ gfc_conv_function_expr (gfc_se * se, gfc_expr * expr) return; } + /* expr.value.function.esym is the resolved (specific) function symbol for + most functions. However this isn't set for dummy procedures. */ + sym = expr->value.function.esym; + if (!sym) + sym = expr->symtree->n.sym; + /* We distinguish statement functions from general functions to improve runtime performance. */ - if (expr->symtree->n.sym->attr.proc == PROC_ST_FUNCTION) + if (sym->attr.proc == PROC_ST_FUNCTION) { gfc_conv_statement_function (se, expr); return; } - /* expr.value.function.esym is the resolved (specific) function symbol for - most functions. However this isn't set for dummy procedures. */ - sym = expr->value.function.esym; - if (!sym) - sym = expr->symtree->n.sym; - gfc_conv_procedure_call (se, sym, expr->value.function.actual, expr, NULL); } diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 5a89be1a98d..e0b5f1130eb 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -1657,6 +1657,35 @@ conv_intrinsic_cobound (gfc_se * se, gfc_expr * expr) static void +conv_intrinsic_stride (gfc_se * se, gfc_expr * expr) +{ + gfc_actual_arglist *array_arg; + gfc_actual_arglist *dim_arg; + gfc_se argse; + tree desc, tmp; + + array_arg = expr->value.function.actual; + dim_arg = array_arg->next; + + gcc_assert (array_arg->expr->expr_type == EXPR_VARIABLE); + + gfc_init_se (&argse, NULL); + gfc_conv_expr_descriptor (&argse, array_arg->expr); + gfc_add_block_to_block (&se->pre, &argse.pre); + gfc_add_block_to_block (&se->post, &argse.post); + desc = argse.expr; + + gcc_assert (dim_arg->expr); + gfc_init_se (&argse, NULL); + gfc_conv_expr_type (&argse, dim_arg->expr, gfc_array_index_type); + gfc_add_block_to_block (&se->pre, &argse.pre); + tmp = fold_build2_loc (input_location, MINUS_EXPR, gfc_array_index_type, + argse.expr, gfc_index_one_node); + se->expr = gfc_conv_descriptor_stride_get (desc, tmp); +} + + +static void gfc_conv_intrinsic_abs (gfc_se * se, gfc_expr * expr) { tree arg, cabs; @@ -6806,6 +6835,10 @@ gfc_conv_intrinsic_function (gfc_se * se, gfc_expr * expr) gfc_conv_intrinsic_spacing (se, expr); break; + case GFC_ISYM_STRIDE: + conv_intrinsic_stride (se, expr); + break; + case GFC_ISYM_SUM: gfc_conv_intrinsic_arith (se, expr, PLUS_EXPR, false); break; diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 921edd042ea..da4fd21effa 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -1,6 +1,6 @@ /* IO Code translation/library interface - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 - Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, + 2012 Free Software Foundation, Inc. Contributed by Paul Brook This file is part of GCC. diff --git a/gcc/fortran/trans-stmt.h b/gcc/fortran/trans-stmt.h index caa4c982b17..6e30bcb98f9 100644 --- a/gcc/fortran/trans-stmt.h +++ b/gcc/fortran/trans-stmt.h @@ -1,5 +1,5 @@ /* Header for statement translation functions - Copyright (C) 2002, 2003, 2006, 2007, 2008, 2010 + Copyright (C) 2002, 2003, 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc. Contributed by Paul Brook diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index 8394bf93576..cd9bde614c1 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -1,6 +1,6 @@ /* Backend support for Fortran 95 basic types and derived types. Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, - 2010, 2011, 2012 + 2010, 2011, 2012, 2013 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> and Steven Bosscher <s.bosscher@student.tudelft.nl> @@ -124,7 +124,7 @@ int gfc_atomic_logical_kind; /* The kind size used for record offsets. If the target system supports kind=8, this will be set to 8, otherwise it is set to 4. */ -int gfc_intio_kind; +int gfc_intio_kind; /* The integer kind used to store character lengths. */ int gfc_charlen_int_kind; @@ -138,7 +138,7 @@ gfc_try gfc_check_any_c_kind (gfc_typespec *ts) { int i; - + for (i = 0; i < ISOCBINDING_NUMBER; i++) { /* Check for any C interoperable kind for the given type/kind in ts. @@ -400,7 +400,7 @@ gfc_init_kinds (void) i_index += 1; } - /* Set the kind used to match GFC_INT_IO in libgfortran. This is + /* Set the kind used to match GFC_INT_IO in libgfortran. This is used for large file access. */ if (saw_i8) @@ -408,8 +408,8 @@ gfc_init_kinds (void) else gfc_intio_kind = 4; - /* If we do not at least have kind = 4, everything is pointless. */ - gcc_assert(saw_i4); + /* If we do not at least have kind = 4, everything is pointless. */ + gcc_assert(saw_i4); /* Set the maximum integer kind. Used with at least BOZ constants. */ gfc_max_integer_kind = gfc_integer_kinds[i_index - 1].kind; @@ -550,7 +550,7 @@ gfc_init_kinds (void) else gfc_default_real_kind = gfc_real_kinds[0].kind; - /* Choose the default double kind. If -fdefault-real and -fdefault-double + /* Choose the default double kind. If -fdefault-real and -fdefault-double are specified, we use kind=8, if it's available. If -fdefault-real is specified without -fdefault-double, we use kind=16, if it's available. Otherwise we do not change anything. */ @@ -1624,10 +1624,10 @@ gfc_get_nodesc_array_type (tree etype, gfc_array_spec * as, gfc_packed packed, type = build_pointer_type (type); if (restricted) - type = build_qualified_type (type, TYPE_QUAL_RESTRICT); + type = build_qualified_type (type, TYPE_QUAL_RESTRICT); GFC_ARRAY_TYPE_P (type) = 1; - TYPE_LANG_SPECIFIC (type) = TYPE_LANG_SPECIFIC (TREE_TYPE (type)); + TYPE_LANG_SPECIFIC (type) = TYPE_LANG_SPECIFIC (TREE_TYPE (type)); } return type; @@ -2286,7 +2286,7 @@ gfc_copy_dt_decls_ifequal (gfc_symbol *from, gfc_symbol *to, a derived type, we need a copy of its component declarations. This is done by recursing into gfc_get_derived_type and ensures that the component's component declarations have - been built. If it is a character, we need the character + been built. If it is a character, we need the character length, as well. */ for (; to_cm; to_cm = to_cm->next, from_cm = from_cm->next) { @@ -2367,7 +2367,7 @@ gfc_get_derived_type (gfc_symbol * derived) BT_INTEGER that needs to fit a void * for the purpose of the iso_c_binding derived types. */ derived->ts.f90_type = BT_VOID; - + return derived->backend_decl; } @@ -2532,6 +2532,15 @@ gfc_get_derived_type (gfc_symbol * derived) field_type = build_pointer_type_for_mode (TREE_TYPE (field_type), ptr_mode, true); + /* Ensure that the CLASS language specific flag is set. */ + if (c->ts.type == BT_CLASS) + { + if (POINTER_TYPE_P (field_type)) + GFC_CLASS_TYPE_P (TREE_TYPE (field_type)) = 1; + else + GFC_CLASS_TYPE_P (field_type) = 1; + } + field = gfc_add_field_to_struct (typenode, get_identifier (c->name), field_type, &chain); @@ -2832,7 +2841,7 @@ gfc_get_function_type (gfc_symbol * sym) && sym->ts.kind == gfc_default_real_kind && !sym->attr.always_explicit) { - /* Special case: f2c calling conventions require that (scalar) + /* Special case: f2c calling conventions require that (scalar) default REAL functions return the C type double instead. f2c compatibility is only an issue with functions that don't require an explicit interface, as only these could be diff --git a/gcc/fortran/trans-types.h b/gcc/fortran/trans-types.h index 29cdf089b49..d8bafbe28e5 100644 --- a/gcc/fortran/trans-types.h +++ b/gcc/fortran/trans-types.h @@ -1,5 +1,5 @@ /* Header for Fortran 95 types backend support. - Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2010 + Copyright (C) 2002, 2003, 2004, 2005, 2007, 2008, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> and Steven Bosscher <s.bosscher@student.tudelft.nl> diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index 70f06fffe99..84b512727f9 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -1,6 +1,6 @@ /* Code translation -- generate GCC trees from gfc_code. Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, - 2012 Free Software Foundation, Inc. + 2011, 2012, 2013 Free Software Foundation, Inc. Contributed by Paul Brook This file is part of GCC. @@ -1023,6 +1023,116 @@ gfc_deallocate_with_status (tree pointer, tree status, tree errmsg, } +/* Build a call to a FINAL procedure, which finalizes "var". */ + +tree +gfc_build_final_call (gfc_typespec ts, gfc_expr *final_wrapper, gfc_expr *var, + bool fini_coarray, gfc_expr *class_size) +{ + stmtblock_t block; + gfc_se se; + tree final_fndecl, array, size, tmp; + + gcc_assert (final_wrapper->expr_type == EXPR_VARIABLE); + gcc_assert (var); + + gfc_init_se (&se, NULL); + gfc_conv_expr (&se, final_wrapper); + final_fndecl = se.expr; + if (POINTER_TYPE_P (TREE_TYPE (final_fndecl))) + final_fndecl = build_fold_indirect_ref_loc (input_location, final_fndecl); + + if (ts.type == BT_DERIVED) + { + tree elem_size; + + gcc_assert (!class_size); + elem_size = gfc_typenode_for_spec (&ts); + elem_size = TYPE_SIZE_UNIT (elem_size); + size = fold_convert (gfc_array_index_type, elem_size); + + gfc_init_se (&se, NULL); + se.want_pointer = 1; + if (var->rank || gfc_expr_attr (var).dimension) + { + se.descriptor_only = 1; + gfc_conv_expr_descriptor (&se, var); + array = se.expr; + if (!POINTER_TYPE_P (TREE_TYPE (array))) + array = gfc_build_addr_expr (NULL, array); + } + else + { + symbol_attribute attr; + gfc_clear_attr (&attr); + gfc_conv_expr (&se, var); + gcc_assert (se.pre.head == NULL_TREE && se.post.head == NULL_TREE); + array = se.expr; + if (TREE_CODE (array) == ADDR_EXPR + && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (array, 0)))) + tmp = TREE_OPERAND (array, 0); + + gfc_init_se (&se, NULL); + array = gfc_conv_scalar_to_descriptor (&se, array, attr); + array = gfc_build_addr_expr (NULL, array); + gcc_assert (se.post.head == NULL_TREE); + } + } + else + { + gfc_expr *array_expr; + gcc_assert (class_size); + gfc_init_se (&se, NULL); + gfc_conv_expr (&se, class_size); + gcc_assert (se.pre.head == NULL_TREE && se.post.head == NULL_TREE); + size = se.expr; + + array_expr = gfc_copy_expr (var); + gfc_add_data_component (array_expr); + gfc_init_se (&se, NULL); + se.want_pointer = 1; + if (array_expr->rank || gfc_expr_attr (array_expr).dimension) + { + se.descriptor_only = 1; + gfc_conv_expr_descriptor (&se, var); + array = se.expr; + if (! POINTER_TYPE_P (TREE_TYPE (array))) + array = gfc_build_addr_expr (NULL, array); + } + else + { + symbol_attribute attr; + + gfc_clear_attr (&attr); + gfc_conv_expr (&se, array_expr); + gcc_assert (se.pre.head == NULL_TREE && se.post.head == NULL_TREE); + array = se.expr; + if (TREE_CODE (array) == ADDR_EXPR + && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (array, 0)))) + tmp = TREE_OPERAND (array, 0); + + /* attr: Argument is neither a pointer/allocatable, + i.e. no copy back needed */ + gfc_init_se (&se, NULL); + array = gfc_conv_scalar_to_descriptor (&se, array, attr); + array = gfc_build_addr_expr (NULL, array); + gcc_assert (se.post.head == NULL_TREE); + } + gfc_free_expr (array_expr); + } + + gfc_start_block (&block); + gfc_add_block_to_block (&block, &se.pre); + tmp = build_call_expr_loc (input_location, + final_fndecl, 3, array, + size, fini_coarray ? boolean_true_node + : boolean_false_node); + gfc_add_block_to_block (&block, &se.post); + gfc_add_expr_to_block (&block, tmp); + return gfc_finish_block (&block); +} + + /* Generate code for deallocation of allocatable scalars (variables or components). Before the object itself is freed, any allocatable subcomponents are being deallocated. */ diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index 17795750573..339261b73e3 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -1,6 +1,6 @@ /* Header for code translation functions Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, - 2011, 2012 + 2011, 2012, 2013 Free Software Foundation, Inc. Contributed by Paul Brook @@ -352,6 +352,8 @@ tree gfc_vtable_final_get (tree); tree gfc_get_vptr_from_expr (tree); tree gfc_get_class_array_ref (tree, tree); tree gfc_copy_class_to_class (tree, tree, tree); +tree gfc_build_final_call (gfc_typespec, gfc_expr *, gfc_expr *, bool, + gfc_expr *); void gfc_conv_derived_to_class (gfc_se *, gfc_expr *, gfc_typespec, tree, bool, bool); void gfc_conv_class_to_class (gfc_se *, gfc_expr *, gfc_typespec, bool, bool, @@ -403,6 +405,9 @@ void gfc_conv_expr_lhs (gfc_se * se, gfc_expr * expr); void gfc_conv_expr_reference (gfc_se * se, gfc_expr *); void gfc_conv_expr_type (gfc_se * se, gfc_expr *, tree); +tree gfc_conv_scalar_to_descriptor (gfc_se *, tree, symbol_attribute); + + /* trans-expr.c */ void gfc_conv_scalar_char_value (gfc_symbol *sym, gfc_se *se, gfc_expr **expr); tree gfc_string_to_single_character (tree len, tree str, int kind); diff --git a/gcc/fortran/types.def b/gcc/fortran/types.def index a2762c6257b..e06c1fea484 100644 --- a/gcc/fortran/types.def +++ b/gcc/fortran/types.def @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 +/* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2011 Free Software Foundation, Inc. This file is part of GCC. |