aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/class.c
AgeCommit message (Collapse)AuthorFilesLines
2013-04-15class.c (gfc_find_intrinsic_vtab): Removed unused var.Tobias Burnus1-3/+1
2013-04-15 Tobias Burnus <burnus@net-b.de> * class.c (gfc_find_intrinsic_vtab): Removed unused var. * dependency.c (check_data_pointer_types): Fix check. * frontend-passes.c (check_data_pointer_types): Remove superfluous statement. * parse.c (decode_omp_directive): Add missing break. * resolve.c (resolve_typebound_subroutine: Free variable. * trans-decl.c (create_function_arglist): Correct condition. From-SVN: r197961
2013-04-11Replace enum gfc_try with bool type.Janne Blomqvist1-46/+46
2013-04-11 Janne Blomqvist <jb@gcc.gnu.org> * gfortran.h: Remove enum gfc_try, replace gfc_try with bool type. * arith.c: Replace gfc_try with bool type. * array.c: Likewise. * check.c: Likewise. * class.c: Likewise. * cpp.c: Likewise. * cpp.h: Likewise. * data.c: Likewise. * data.h: Likewise. * decl.c: Likewise. * error.c: Likewise. * expr.c: Likewise. * f95-lang.c: Likewise. * interface.c: Likewise. * intrinsic.c: Likewise. * intrinsic.h: Likewise. * io.c: Likewise. * match.c: Likewise. * match.h: Likewise. * module.c: Likewise. * openmp.c: Likewise. * parse.c: Likewise. * parse.h: Likewise. * primary.c: Likewise. * resolve.c: Likewise. * scanner.c: Likewise. * simplify.c: Likewise. * symbol.c: Likewise. * trans-intrinsic.c: Likewise. * trans-openmp.c: Likewise. * trans-stmt.c: Likewise. * trans-types.c: Likewise. From-SVN: r197682
2013-03-312013-03-31 Tobias Burnus <burnus@net-b.de>Tobias Burnus1-17/+26
* class.c (finalization_scalarizer, * finalizer_insert_packed_call, generate_finalization_wrapper): Avoid segfault with absent SIZE= argment to TRANSFER and use correct result kind for SIZE. * intrinsic.c (gfc_isym_id_by_intmod): Also handle ids of nonmodules. * trans.c (gfc_build_final_call): Handle coarrays. From-SVN: r197281
2013-01-27[multiple changes]Paul Thomas1-1/+1
2013-01-27 Paul Thomas <pault@gcc.gnu.org> PR fortran/55789 PR fortran/56047 * gfortran.h : Add associate_var to symbol_attr. * resolve.c (resolve_assoc_var): Set associate_var attribute. If the target class_ok is set, set it for the associate variable. * check.c (allocatable_check): Associate variables should not have the allocatable attribute even if their symbols do. * class.c (gfc_build_class_symbol): Symbols with associate_var set will always have a good class container. 2013-01-27 Paul Thomas <pault@gcc.gnu.org> PR fortran/55789 * gfortran.dg/associate_14.f90: New test. PR fortran/56047 * gfortran.dg/associate_13.f90: New test. From-SVN: r195492
2013-01-16re PR fortran/55983 (ICE in find_typebound_proc_uop, at fortran/class.c:2711)Janus Weil1-5/+7
2013-01-16 Janus Weil <janus@gcc.gnu.org> PR fortran/55983 * class.c (find_typebound_proc_uop): Check for f2k_derived instead of asserting it. 2013-01-16 Janus Weil <janus@gcc.gnu.org> PR fortran/55983 * gfortran.dg/class_55.f90: New. From-SVN: r195251
2013-01-12re PR fortran/55868 (gfortran generates for CLASS(*) __m_MOD___vtab__$tar ↵Paul Thomas1-2/+2
on NO_DOLLAR_IN_LABEL systems) 2013-01-08 Paul Thomas <pault@gcc.gnu.org> PR fortran/55868 * class.c (get_unique_type_string): Change $tar to STAR and replace sprintf by strcpy where there is no formatting. * decl.c (gfc_match_decl_type_spec): Change $tar to STAR. 2013-01-08 Paul Thomas <pault@gcc.gnu.org> PR fortran/55868 * gfortran.dg/unlimited_polymorphic_8.f90: Update scan-tree-dump-times for foo.0.x._vptr to deal with change from $tar to STAR. From-SVN: r195124
2013-01-10Update copyright years in gcc/Richard Sandiford1-2/+1
From-SVN: r195098
2013-01-07re PR fortran/55852 (internal compiler error: in gfc_build_intrinsic_call, ↵Tobias Burnus1-137/+50
at fortran/expr.c:4647) 2013-01-07 Tobias Burnus <burnus@net-b.de> Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/55852 * expr.c (gfc_build_intrinsic_call): Avoid clashes with user's procedures. * gfortran.h (gfc_build_intrinsic_call): Update prototype. * simplify.c (gfc_simplify_size): Update call. * class.c (finalization_scalarizer, finalization_get_offset, finalizer_insert_packed_call, generate_finalization_wrapper): Clean up by using gfc_build_intrinsic_call. 2013-01-07 Tobias Burnus <burnus@net-b.de> PR fortran/55852 * gfortran.dg/intrinsic_size_3.f90: New. Co-Authored-By: Thomas Koenig <tkoenig@gcc.gnu.org> From-SVN: r194966
2013-01-05re PR fortran/55827 (ICE with multiple fortran modules and character lenght ↵Steven G. Kargl1-1/+17
determined by an interfaced pure function) 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 Steven G. Kargl <kargl@gcc.gnu.org> Mikael Morin <mikael@gcc.gnu.org> PR fortran/55827 * gfortran.dg/use_22.f90: New test. Co-Authored-By: Mikael Morin <mikael@gcc.gnu.org> From-SVN: r194928
2013-01-05class.c (finalize_component): Used passed offset expr.Tobias Burnus1-166/+587
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. From-SVN: r194927
2013-01-04class.c (gfc_find_intrinsic_vtab): Add _final component.Tobias Burnus1-1/+10
2013-01-04 Tobias Burnus <burnus@net-b.de> * class.c (gfc_find_intrinsic_vtab): Add _final component. From-SVN: r194917
2013-01-04re PR fortran/55854 (ICE on intent(out) dummy argument with unlimited ↵Tobias Burnus1-8/+4
polymorphic component) 2013-01-03 Tobias Burnus <burnus@net-b.de> PR fortran/55854 PR fortran/55763 * class.c (gfc_class_null_initializer): Fix finding the vtab. (gfc_find_intrinsic_vtab): Use BT_VOID for some components. 2013-01-03 Tobias Burnus <burnus@net-b.de> PR fortran/55854 PR fortran/55763 * gfortran.dg/unlimited_polymorphic_3.f03: Remove invalid code. * gfortran.dg/unlimited_polymorphic_7.f90: New. * gfortran.dg/unlimited_polymorphic_8.f90: New. From-SVN: r194885
2012-12-20array.c (resolve_array_list): Apply C4106.Paul Thomas1-38/+325
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 Paul Thomas <pault@gcc.gnu.org> * intrinsics/extends_type_of.c : Return correct results for null vptrs. 2012-12-19 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/unlimited_polymorphic_1.f03: New test. * gfortran.dg/unlimited_polymorphic_2.f03: New test. * gfortran.dg/unlimited_polymorphic_3.f03: New test. * gfortran.dg/same_type_as.f03: Correct for improved message. From-SVN: r194622
2012-12-03re PR fortran/37336 ([F03] Finish derived-type finalization)Tobias Burnus1-0/+42
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. Co-Authored-By: Janus Weil <janus@gcc.gnu.org> From-SVN: r194104
2012-12-03re PR fortran/37336 ([F03] Finish derived-type finalization)Tobias Burnus1-104/+442
2012-11-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. From-SVN: r194075
2012-09-15arith.c (arith_power): Call gfc_free_expr in case of error.Tobias Burnus1-1/+4
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 From-SVN: r191344
2012-09-03re PR fortran/54467 (f951: internal compiler error: in ↵Tobias Burnus1-1/+1
gfc_add_component_ref, at fortran/class.c:213) 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. From-SVN: r190892
2012-09-03class.c (gfc_find_derived_vtab): Disable ABI-breaking generation of the ↵Tobias Burnus1-1/+4
"_final" subroutine for now. 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. From-SVN: r190872
2012-09-03class.c (finalize_component): Fixes to the comment.Tobias Burnus1-2/+2
2012-09-03 Tobias Burnus <burnus@net-b.de> * class.c (finalize_component): Fixes to the comment. From-SVN: r190870
2012-09-03[multiple changes]Tobias Burnus1-4/+725
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-03 Tobias Burnus <burnus@net-b.de> PR fortran/51632 * gfortran.dg/coarray_class_1.f90: New. From-SVN: r190869
2012-07-20re PR fortran/48820 (TR 29113: Implement parts needed for MPI 3)Tobias Burnus1-3/+7
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-20 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * gfortran.dg/assumed_type_3.f90: Update dg-error. * gfortran.dg/assumed_rank_1.f90: New. * gfortran.dg/assumed_rank_1_c.c: New. * gfortran.dg/assumed_rank_2.f90: New. * gfortran.dg/assumed_rank_4.f90: New. * gfortran.dg/assumed_rank_5.f90: New. * gfortran.dg/assumed_rank_6.f90: New. * gfortran.dg/assumed_rank_7.f90: New. * gfortran.dg/assumed_rank_8.f90: New. * gfortran.dg/assumed_rank_8_c.c: New. * gfortran.dg/assumed_rank_9.f90: New. * gfortran.dg/assumed_rank_10.f90: New. * gfortran.dg/assumed_rank_12.f90: New. From-SVN: r189700
2012-07-08gfortran.h: Do not include coretypes.h here.Steven Bosscher1-0/+1
* 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. From-SVN: r189357
2012-04-16re PR fortran/52968 ([OOP] Call to type-bound procedure wrongly rejected)Janus Weil1-4/+1
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-16 Janus Weil <janus@gcc.gnu.org> PR fortran/52968 * gfortran.dg/typebound_call_23.f03: New test case. From-SVN: r186486
2012-03-04re PR fortran/50981 ([OOP] Wrong-code for scalarizing ELEMENTAL call with ↵Mikael Morin1-0/+33
absent OPTIONAL argument) fortran/ 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. testsuite/ PR fortran/50981 * gfortran.dg/elemental_optional_args_5.f03: Add subcomponent actual argument checks. From-SVN: r184904
2012-02-02re PR fortran/41587 ([OOP] ICE with ALLOCATABLE CLASS components)Mikael Morin1-0/+123
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 Mikael Morin <mikael@gcc.gnu.org> PR fortran/41587 * gfortran.dg/class_array_10.f03: New test. PR fortran/46356 * gfortran.dg/class_array_11.f03: New test. PR fortran/51754 * gfortran.dg/class_array_12.f03: New test. From-SVN: r183853
2012-01-31re PR fortran/52029 ([OOP] _copy should be PURE)Tobias Burnus1-0/+1
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/52029 * gfortran.dg/class_49.f90: New. From-SVN: r183770
2012-01-31re PR fortran/52013 ([OOP] Polymorphism and coarrays: Support as class ↵Tobias Burnus1-6/+8
container) 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 Tobias Burnus <burnus@net-b.de> PR fortran/52013 From-SVN: r183769
2012-01-25re PR fortran/51995 ([OOP] Polymorphic class fails at runtime)Tobias Burnus1-1/+1
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. From-SVN: r183541
2012-01-25re PR fortran/51995 ([OOP] Polymorphic class fails at runtime)Tobias Burnus1-0/+2
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/51995 * gfortran.dg/typebound_proc_25.f90: New. From-SVN: r183528
2012-01-16re PR fortran/51809 ([OOP] ICE (segfault) depending on USE statements order)Tobias Burnus1-2/+2
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 Tobias Burnus <burnus@net-b.de> PR fortran/51809 * gfortran.dg/use_20.f90: New From-SVN: r183219
2012-01-13re PR fortran/48351 ([OOP] Realloc on assignment fails if parent component ↵Paul Thomas1-0/+1
is CLASS) 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 Paul Thomas <pault@gcc.gnu.org> PR fortran/48351 * gfortran.dg/alloc_comp_assign.f03: New. * gfortran.dg/allocatable_scalar_9.f90: Reduce count of __BUILTIN_FREE from 38 to 32. From-SVN: r183162
2011-12-11re PR fortran/41539 ([OOP] Calling function which takes CLASS: Rank ↵Paul Thomas1-11/+173
comparison does not work) 2011-12-11 Paul Thomas <pault@gcc.gnu.org> Tobias Burnus <burnus@gcc.gnu.org> PR fortran/41539 PR fortran/43214 PR fortran/43969 PR fortran/44568 PR fortran/46356 PR fortran/46990 PR fortran/49074 * interface.c(symbol_rank): Return the rank of the _data component of class objects. (compare_parameter): Also compare the derived type of the class _data component for type mismatch. Similarly, return 1 if the formal and _data ranks match. (compare_actual_formal): Do not compare storage sizes for class expressions. It is an error if an actual class array, passed to a formal class array is not full. * trans-expr.c (gfc_class_data_get, gfc_class_vptr_get, gfc_vtable_field_get, gfc_vtable_hash_get, gfc_vtable_size_get, gfc_vtable_extends_get, gfc_vtable_def_init_get, gfc_vtable_copy_get): New functions for class API. (gfc_conv_derived_to_class): For an array reference in an elemental procedure call retain the ss to provide the scalarized array reference. Moved in file. (gfc_conv_class_to_class): New function. (gfc_conv_subref_array_arg): Use the type of the class _data component as a basetype. (gfc_conv_procedure_call): Ensure that class array expressions have both the _data reference and an array reference. Use gfc_conv_class_to_class to handle class arrays for elemental functions in scalarized loops, class array elements and full class arrays. Use a call to gfc_conv_subref_array_arg in order that the copy-in/copy-out for passing class arrays to derived type arrays occurs correctly. (gfc_conv_expr): If it is missing, add the _data component between a class object or component and an array reference. (gfc_trans_class_array_init_assign): New function. (gfc_trans_class_init_assign): Call it for array expressions. * trans-array.c (gfc_add_loop_ss_code): Do not use a temp for class scalars since their size will depend on the dynamic type. (build_class_array_ref): New function. (gfc_conv_scalarized_array_ref): Call build_class_array_ref. (gfc_array_init_size): Add extra argument, expr3, that represents the SOURCE argument. If present,use this for the element size. (gfc_array_allocate): Also add argument expr3 and use it when calling gfc_array_init_size. (structure_alloc_comps): Enable class arrays. * class.c (gfc_add_component_ref): Carry over the derived type of the _data component. (gfc_add_class_array_ref): New function. (class_array_ref_detected): New static function. (gfc_is_class_array_ref): New function that calls previous. (gfc_is_class_scalar_expr): New function. (gfc_build_class_symbol): Throw not implemented error for assumed size class arrays. Remove error that prevents CLASS arrays. (gfc_build_class_symbol): Prevent pointer/allocatable conflict. Also unset codimension. (gfc_find_derived_vtab): Make 'copy' elemental and set the intent of the arguments accordingly.: * trans-array.h : Update prototype for gfc_array_allocate. * array.c (gfc_array_dimen_size): Return failure if class expr. (gfc_array_size): Likewise. * gfortran.h : New prototypes for gfc_add_class_array_ref, gfc_is_class_array_ref and gfc_is_class_scalar_expr. * trans-stmt.c (trans_associate_var): Exclude class targets from test. Move the allocation of the _vptr to an earlier time for class objects. (trans_associate_var): Assign the descriptor directly for class arrays. (gfc_trans_allocate): Add expr3 to gfc_array_allocate arguments. Convert array element references into sections. Do not invoke gfc_conv_procedure_call, use gfc_trans_call instead. * expr.c (gfc_get_corank): Fix for BT_CLASS. (gfc_is_simply_contiguous): Exclude class from test. * trans.c (gfc_build_array_ref): Include class array refs. * trans.h : Include prototypes for class API functions that are new in trans-expr. Define GFC_DECL_CLASS(node). * resolve.c (check_typebound_baseobject ): Remove error for non-scalar base object. (resolve_allocate_expr): Ensure that class _data component is present. If array, call gfc_expr_to_intialize. (resolve_select): Remove scalar error for SELECT statement as a temporary measure. (resolve_assoc_var): Update 'target' (aka 'selector') as needed. Ensure that the target expression has the right rank. (resolve_select_type): Ensure that target expressions have a valid locus. (resolve_allocate_expr, resolve_fl_derived0): Fix for BT_CLASS. * trans-decl.c (gfc_get_symbol_decl): Set GFC_DECL_CLASS, where appropriate. (gfc_trans_deferred_vars): Get class arrays right. * match.c(select_type_set_tmp): Add array spec to temporary. (gfc_match_select_type): Allow class arrays. * check.c (array_check): Ensure that class arrays have refs. (dim_corank_check, dim_rank_check): Retrun success if class. * primary.c (gfc_match_varspec): Fix for class arrays and co-arrays. Make sure that class _data is present. (gfc_match_rvalue): Handle class arrays. *trans-intrinsic.c (gfc_conv_intrinsic_size): Add class array reference. (gfc_conv_allocated): Add _data component to class expressions. (gfc_add_intrinsic_ss_code): ditto. * simplify.c (simplify_cobound): Fix for BT_CLASS. (simplify_bound): Return NULL for class arrays. (simplify_cobound): Obtain correct array_spec. Use cotype as appropriate. Use arrayspec for bounds. 2011-12-11 Paul Thomas <pault@gcc.gnu.org> Tobias Burnus <burnus@gcc.gnu.org> PR fortran/41539 PR fortran/43214 PR fortran/43969 PR fortran/44568 PR fortran/46356 PR fortran/46990 PR fortran/49074 * gfortran.dg/class_array_1.f03: New. * gfortran.dg/class_array_2.f03: New. * gfortran.dg/class_array_3.f03: New. * gfortran.dg/class_array_4.f03: New. * gfortran.dg/class_array_5.f03: New. * gfortran.dg/class_array_6.f03: New. * gfortran.dg/class_array_7.f03: New. * gfortran.dg/class_array_8.f03: New. * gfortran.dg/coarray_poly_1.f90: New. * gfortran.dg/coarray_poly_2.f90: New. * gfortran.dg/coarray/poly_run_1.f90: New. * gfortran.dg/coarray/poly_run_2.f90: New. * gfortran.dg/class_to_type_1.f03: New. * gfortran.dg/type_to_class_1.f03: New. * gfortran.dg/typebound_assignment_3.f03: Remove the error. * gfortran.dg/auto_dealloc_2.f90: Occurences of __builtin_free now 2. * gfortran.dg/class_19.f03: Occurences of __builtin_free now 8. Co-Authored-By: Tobias Burnus <burnus@gcc.gnu.org> From-SVN: r182210
2011-12-03re PR fortran/48887 ([OOP] SELECT TYPE: Associate name shall not be a ↵Tobias Burnus1-2/+4
pointer/allocatable) 2011-12-03 Tobias Burnus <burnus@net-b.de> PR fortran/48887 * match.c (select_type_set_tmp): Don't set allocatable/pointer attribute. * class.c (gfc_build_class_symbol): Handle attr.select_type_temporary. 2011-12-03 Tobias Burnus <burnus@net-b.de> PR fortran/48887 * gfortran.dg/select_type_24.f90: New. * gfortran.dg/select_type_23.f03: Add dg-error. * gfortran.dg/class_45a.f03: Add missing TARGET attribute. From-SVN: r181975
2011-11-19re PR fortran/51207 ([OOP] Mark __def_init_... as FL_PARAMETER)Tobias Burnus1-1/+2
2011-11-19 Tobias Burnus <burnus@net-b.de> PR fortran/51207 * class.c (gfc_find_derived_vtab): Mark __def_init as PARAMETER and hence as TREE_READONLY; add subroutine attribute to __copy_ procedure. PR fortran/50640 * trans.h (GFC_DECL_PUSH_TOPLEVEL): New DECL_LANG_FLAG_7. * trans-decl.c (gfc_get_symbol_decl): Mark __def_init and vtab as GFC_DECL_PUSH_TOPLEVEL. (gfc_generate_function_code): If GFC_DECL_PUSH_TOPLEVEL, push it there. (build_function_decl): Push __copy_ procedure to the toplevel. From-SVN: r181505
2011-11-09re PR fortran/50960 ([OOP] vtables not marked as constant)Janus Weil1-1/+1
2011-11-09 Janus Weil <janus@gcc.gnu.org> PR fortran/50960 * class.c (gfc_find_derived_vtab): Make the vtab symbols FL_PARAMETER. * expr.c (gfc_simplify_expr): Prevent vtabs from being replaced with their value. * resolve.c (resolve_values): Use-associated symbols do not need to be resolved again. (resolve_fl_parameter): Make sure the symbol has a value. From-SVN: r181199
2011-11-07re PR fortran/50919 ([OOP] Don't use vtable for NON_OVERRIDABLE TBP)Janus Weil1-0/+4
2011-11-07 Janus Weil <janus@gcc.gnu.org> PR fortran/50919 * class.c (add_proc_comp): Don't add non-overridable procedures to the vtable. * resolve.c (resolve_typebound_function,resolve_typebound_subroutine): Don't generate a dynamic _vptr call for non-overridable procedures. 2011-11-07 Janus Weil <janus@gcc.gnu.org> PR fortran/50919 * gfortran.dg/typebound_call_21.f03: New. From-SVN: r181107
2011-10-07re PR fortran/50625 ([OOP] ALLOCATABLE attribute lost for module CLASS ↵Janus Weil1-1/+1
variables) 2011-10-07 Janus Weil <janus@gcc.gnu.org> PR fortran/50625 * class.c (gfc_build_class_symbol): Fix whitespace. * module.c (mio_symbol): Set 'class_ok' attribute. * trans-decl.c (gfc_get_symbol_decl): Make sure the backend_decl has been built for class symbols. 2011-10-07 Janus Weil <janus@gcc.gnu.org> PR fortran/50625 * gfortran.dg/class_46.f03: New. From-SVN: r179660
2011-06-21re PR fortran/49112 ([OOP] Missing type-bound procedure, "duplicate save" ↵Janus Weil1-2/+2
warnings and internal compiler error) 2011-06-21 Janus Weil <janus@gcc.gnu.org> PR fortran/49112 * class.c (gfc_find_derived_vtab): Make vtab and default initialization symbols SAVE_IMPLICIT. 2011-06-21 Janus Weil <janus@gcc.gnu.org> PR fortran/49112 * gfortran.dg/class_44.f03: New. From-SVN: r175257
2011-03-26re PR fortran/48291 ([OOP] internal compiler error, new_symbol(): Symbol ↵Janus Weil1-3/+3
name too long) 2011-03-26 Janus Weil <janus@gcc.gnu.org> PR fortran/48291 * class.c (get_unique_hashed_string): Adjust maximum allowable length for unique type string. 2011-03-26 Janus Weil <janus@gcc.gnu.org> PR fortran/48291 * gfortran.dg/class_42.f03: New. From-SVN: r171559
2011-02-16re PR fortran/47745 ([OOP] Segfault with CLASS(*) and derived type dummy ↵Janus Weil1-0/+10
arguments) 2011-02-16 Janus Weil <janus@gcc.gnu.org> PR fortran/47745 * class.c (gfc_build_class_symbol): Set 'class_ok' attribute. * decl.c (build_sym,attr_decl1): Move setting of 'class_ok' into 'gfc_build_class_symbol'. (gfc_match_decl_type_spec): Reject unlimited polymorphism. * interface.c (matching_typebound_op): Check for 'class_ok' attribute. * match.c (select_type_set_tmp): Move setting of 'class_ok' into 'gfc_build_class_symbol'. * primary.c (gfc_variable_attr): Check for 'class_ok' attribute. 2011-02-16 Janus Weil <janus@gcc.gnu.org> PR fortran/47745 * gfortran.dg/class_39.f03: New. From-SVN: r170223
2011-02-14re PR fortran/47728 ([OOP] ICE on invalid CLASS declaration)Janus Weil1-1/+1
2011-02-14 Janus Weil <janus@gcc.gnu.org> PR fortran/47728 * class.c (gfc_build_class_symbol): Give a fatal error on polymorphic arrays. * primary.c (gfc_match_varspec): Avoid ICE for invalid class declaration. 2011-02-14 Janus Weil <janus@gcc.gnu.org> PR fortran/47728 * gfortran.dg/class_38.f03: New. From-SVN: r170144
2011-02-12class.c (gfc_build_class_symbol): Reject polymorphic arrays.Janus Weil1-0/+6
2011-02-12 Janus Weil <janus@gcc.gnu.org> * class.c (gfc_build_class_symbol): Reject polymorphic arrays. * decl.c (build_sym,build_struct,attr_decl1): Use return value of 'gfc_build_class_symbol'. 2011-02-12 Janus Weil <janus@gcc.gnu.org> * gfortran.dg/allocate_derived_1.f90: Modified as polymorphic arrays are temporarily disabled. * gfortran.dg/class_7.f03: Ditto. * gfortran.dg/coarray_14.f90: Ditto. * gfortran.dg/typebound_proc_13.f03: Ditto. From-SVN: r170092
2011-01-09re PR fortran/46313 ([OOP] class container naming collisions)Janus Weil1-4/+7
2011-01-09 Janus Weil <janus@gcc.gnu.org> PR fortran/46313 * class.c (get_unique_type_string): Make type name start with upper case letter. 2011-01-09 Janus Weil <janus@gcc.gnu.org> PR fortran/46313 * gfortran.dg/class_35.f90: New. From-SVN: r168610
2011-01-07re PR fortran/47189 ([OOP] calling STORAGE_SIZE on a NULL-initialized class ↵Janus Weil1-4/+6
pointer) 2011-01-07 Janus Weil <janus@gcc.gnu.org> PR fortran/47189 PR fortran/47194 * gfortran.h (gfc_lval_expr_from_sym): Moved prototype. * class.c (gfc_class_null_initializer): Initialize _vptr to declared type. * expr.c (gfc_lval_expr_from_sym): Moved here from symbol.c. * resolve.c (resolve_deallocate_expr): _data component will be added at translation stage. * symbol.c (gfc_lval_expr_from_sym): Moved to expr.c. * trans-stmt.c (gfc_trans_deallocate): Reset _vptr to declared type. 2011-01-07 Janus Weil <janus@gcc.gnu.org> PR fortran/47189 PR fortran/47194 * gfortran.dg/storage_size_3.f08: Extended. From-SVN: r168565
2011-01-04re PR fortran/46448 ([OOP] symbol `__copy_...' is already defined)Janus Weil1-0/+2
2011-01-04 Janus Weil <janus@gcc.gnu.org> PR fortran/46448 * class.c (gfc_find_derived_vtab): Set the module field for the copying routine to make sure it receives module name mangling. 2011-01-04 Janus Weil <janus@gcc.gnu.org> PR fortran/46448 * gfortran.dg/class_34.f90: New. From-SVN: r168464
2011-01-02re PR fortran/46408 ([OOP] Segfault when running ↵Janus Weil1-1/+1
gfortran.dg/class_allocate_6.f03) 2011-01-02 Janus Weil <janus@gcc.gnu.org> PR fortran/46408 * class.c (gfc_find_derived_vtab): Use EXEC_INIT_ASSIGN for __copy_ routine. 2011-01-02 Janus Weil <janus@gcc.gnu.org> PR fortran/46408 * gfortran.dg/class_19.f03: Adjust counting of __builtin_free. From-SVN: r168409
2010-12-31re PR fortran/46971 ([OOP] ICE on long class names)Janus Weil1-6/+50
2010-12-31 Janus Weil <janus@gcc.gnu.org> PR fortran/46971 * gfortran.h (gfc_hash_value): Add prototype. * class.c (get_unique_type_string): Check if proc_name is present and make sure string contains an underscore. (get_unique_hashed_string): New function which creates a hashed string if the given unique string is too long. (gfc_hash_value): Moved here from decl.c, renamed and simplified. (gfc_build_class_symbol, gfc_find_derived_vtab): Use hashed strings. * decl.c (hash_value): Moved to class.c. (gfc_match_derived_decl): Renamed 'hash_value'. 2010-12-31 Janus Weil <janus@gcc.gnu.org> PR fortran/46971 * gfortran.dg/class_33.f90: New. From-SVN: r168363
2010-11-09re PR fortran/46313 ([OOP] class container naming collisions)Janus Weil1-37/+54
2010-11-09 Janus Weil <janus@gcc.gnu.org> PR fortran/46313 * gfortran.h (gfc_add_data_component,gfc_add_vptr_component, gfc_add_hash_component,gfc_add_size_component, gfc_add_def_init_component): New macros. * class.c (gfc_add_component_ref): Renamed data component. (get_unique_type_string): New function. (gfc_build_class_symbol): Use 'get_unique_type_string' to construct uniques names for the class containers. Rename components. (gfc_find_derived_vtab): Use 'get_unique_type_string' to construct uniques names for the vtab symbols. Rename components. * decl.c (attr_decl1): Renamed class container components. * iresolve.c (gfc_resolve_extends_type_of): Ditto. * match.c (select_type_set_tmp): Renamed temporaries. * module.c (read_module): Renamed vtab and vtype symbols. * resolve.c (resolve_structure_cons,resolve_typebound_function, resolve_typebound_subroutine,resolve_deallocate_expr, resolve_select_type,resolve_fl_derived): Renamed class container and vtab components. * trans-array.c (structure_alloc_comps): Ditto. * trans-decl.c (gfc_trans_deferred_vars): Ditto. * trans-expr.c (gfc_conv_derived_to_class,gfc_conv_structure, gfc_trans_class_init_assign,gfc_trans_class_assign): Ditto. * trans-intrinsic.c (gfc_conv_intrinsic_sizeof, gfc_conv_intrinsic_storage_size,gfc_conv_allocated,gfc_conv_associated, gfc_conv_same_type_as): Ditto. * trans-stmt.c (gfc_trans_allocate): Ditto. 2010-11-09 Janus Weil <janus@gcc.gnu.org> PR fortran/46313 * gfortran.dg/class_29.f03: New. From-SVN: r166480
2010-11-05re PR fortran/45451 ([OOP] Inconsistent status of ALLOCATABLE components ↵Janus Weil1-13/+80
inside CLASS variables.) 2010-11-05 Janus Weil <janus@gcc.gnu.org> PR fortran/45451 PR fortran/46174 * class.c (gfc_find_derived_vtab): Improved search for existing vtab. Add component '$copy' to vtype symbol for polymorphic deep copying. * expr.c (gfc_check_pointer_assign): Make sure the vtab is generated during resolution stage. * resolve.c (resolve_codes): Don't resolve code if namespace is already resolved. * trans-stmt.c (gfc_trans_allocate): Call '$copy' procedure for polymorphic ALLOCATE statements with SOURCE. 2010-11-05 Janus Weil <janus@gcc.gnu.org> PR fortran/45451 PR fortran/46174 * gfortran.dg/class_19.f03: Modified. * gfortran.dg/class_allocate_6.f03: New. From-SVN: r166368
2010-09-01re PR fortran/44541 ([OOP] wrong code for polymorphic variable with ↵Janus Weil1-1/+30
INTENT(OUT)/Alloc w/ MOLD) 2010-09-01 Janus Weil <janus@gcc.gnu.org> PR fortran/44541 * class.c (gfc_find_derived_vtab): Add component '$def_init'. * resolve.c (resolve_allocate_expr): Defer handling of default initialization to 'gfc_trans_allocate'. (apply_default_init,resolve_symbol): Handle polymorphic dummies. (resolve_fl_derived): Suppress error messages for vtypes. * trans-stmt.c (gfc_trans_allocate): Handle initialization via polymorphic MOLD expression. * trans-expr.c (gfc_trans_class_init_assign): Now only used for dummy initialization. 2010-09-01 Janus Weil <janus@gcc.gnu.org> PR fortran/44541 * gfortran.dg/allocate_alloc_opt_10.f90: Extended. * gfortran.dg/class_dummy_1.f03: New. From-SVN: r163744