Commit Graph

216 Commits

Author SHA1 Message Date
Janne Blomqvist
524af0d6c7 Replace enum gfc_try with bool type.
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-04-11 00:36:58 +03:00
Janus Weil
9362a03b87 re PR fortran/56284 ([OOP] ICE with alternate return in type-bound procedure)
2013-04-03  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/56284
	PR fortran/40881
	* decl.c (gfc_match_formal_arglist): Warn about alternate-return
	arguments.
	* interface.c (check_dummy_characteristics): Return if symbols are NULL.

2013-04-03  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/56284
	PR fortran/40881
	* gfortran.dg/altreturn_8.f90: New.
	* gfortran.dg/altreturn_2.f90: Add -std=legacy.
	* gfortran.dg/intrinsic_actual_3.f90: Ditto.
	* gfortran.dg/invalid_interface_assignment.f90: Ditto.

From-SVN: r197389
2013-04-03 09:31:23 +02:00
Janus Weil
4cbc903996 re PR fortran/54107 ([F03] Memory hog with abstract interface)
2013-01-29  Janus Weil  <janus@gcc.gnu.org>
	    Mikael Morin <mikael@gcc.gnu.org>

	PR fortran/54107
	* gfortran.h (gfc_component): Delete members 'formal' and 'formal_ns'.
	(gfc_copy_formal_args,gfc_copy_formal_args_ppc,gfc_expr_replace_symbols,
	gfc_expr_replace_comp): Delete.
	(gfc_sym_get_dummy_args): New prototype.
	* dependency.c (gfc_check_fncall_dependency): Use
	'gfc_sym_get_dummy_args'.
	* expr.c (gfc_is_constant_expr): Ditto.
	(replace_symbol,gfc_expr_replace_symbols,replace_comp,
	gfc_expr_replace_comp): Deleted.
	* frontend-passes.c (doloop_code,do_function): Use
	'gfc_sym_get_dummy_args'.
	* interface.c (gfc_check_operator_interface,gfc_compare_interfaces,
	gfc_procedure_use,gfc_ppc_use,gfc_arglist_matches_symbol,
	gfc_check_typebound_override): Ditto.
	* module.c (MOD_VERSION): Bump module version.
	(mio_component): Do not read/write 'formal' and 'formal_ns'.
	* resolve.c (resolve_procedure_interface,resolve_fl_derived0): Do not
	copy formal args, but just keep a pointer to the interface.
	(resolve_function,resolve_call,resolve_typebound_generic_call,
	resolve_ppc_call,resolve_expr_ppc,generate_component_assignments,
	resolve_fl_procedure,gfc_resolve_finalizers,check_generic_tbp_ambiguity,
	resolve_typebound_procedure,check_uop_procedure): Use
	'gfc_sym_get_dummy_args'.
	* symbol.c (free_components): Do not free 'formal' and 'formal_ns'.
	(gfc_copy_formal_args,gfc_copy_formal_args_ppc): Deleted.
	(gfc_sym_get_dummy_args): New function.
	* trans-array.c (get_array_charlen,gfc_walk_elemental_function_args):
	Use 'gfc_sym_get_dummy_args'.
	* trans-decl.c (build_function_decl,create_function_arglist,
	build_entry_thunks,init_intent_out_dt,gfc_trans_deferred_vars,
	add_argument_checking): Ditto.
	* trans-expr.c (gfc_map_fcn_formal_to_actual,gfc_conv_procedure_call,
	gfc_conv_statement_function): Ditto.
	* trans-stmt.c (gfc_conv_elemental_dependencies): Ditto.
	* trans-types.c (create_fn_spec,gfc_get_function_type): Ditto.


2013-01-29  Janus Weil  <janus@gcc.gnu.org>
	    Mikael Morin <mikael@gcc.gnu.org>

	PR fortran/54107
	* gfortran.dg/proc_ptr_comp_36.f90: New.

Co-Authored-By: Mikael Morin <mikael@gcc.gnu.org>

From-SVN: r195562
2013-01-29 22:40:51 +01:00
Richard Sandiford
d1e082c2c2 Update copyright years in gcc/
From-SVN: r195098
2013-01-10 20:38:27 +00:00
Tobias Burnus
5cf8132adb re PR fortran/54884 (Externally used PRIVATE module procedure wrongly marked as TREE_PUBLIC()=0)
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-23  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54884
        * gfortran.dg/public_private_module_8.f90: New.

From-SVN: r194706
2012-12-23 19:43:32 +01:00
Paul Thomas
8b7043164f array.c (resolve_array_list): Apply C4106.
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-20 00:15:00 +00:00
Tobias Burnus
57bf28eab7 re PR fortran/54958 (Wrongly rejects ac-implied-DO variables which also occur with INTENT(IN))
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-28  Tobias Burnus  <burnus@net-b.de>

        PR fortran/54958
        * gfortran.dg/do_check_6.f90: New.

From-SVN: r192896
2012-10-28 17:57:12 +01:00
Janus Weil
f2f8171fb1 re PR fortran/40453 ([F95] Enhanced (recursive) argument checking)
2012-10-12  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40453
	* interface.c (check_dummy_characteristics): Recursively check dummy
	procedures.

2012-10-12  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/40453
	* gfortran.dg/dummy_procedure_9.f90: New.

From-SVN: r192391
2012-10-12 10:16:17 +02:00
Janus Weil
e9355cc32e re PR fortran/45521 ([F08] GENERIC resolution with ALLOCATABLE/POINTER and PROCEDURE)
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-06  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/45521
	* gfortran.dg/generic_25.f90: New.
	* gfortran.dg/generic_26.f90: New.
	* gfortran.dg/generic_27.f90: New.

From-SVN: r192157
2012-10-06 14:20:09 +02:00
Tobias Burnus
efb63364c5 expr.c (scalarize_intrinsic_call): Plug memory leak.
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.

From-SVN: r192094
2012-10-04 19:32:06 +02:00
Janus Weil
0a59e5832e re PR fortran/54778 ([OOP] an ICE on invalid OO code)
2012-10-02  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/54778
	* interface.c (matching_typebound_op): Check for 'class_ok' attribute.

2012-10-02  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/54778
	* gfortran.dg/class_53.f90: New.

From-SVN: r192005
2012-10-02 23:02:16 +02:00
Tobias Burnus
c6423ef3e0 error.c (error_print): Move increment out of the assert.
2012-09-17  Tobias Burnus  <burnus@net-b.de>

        * 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.

From-SVN: r191381
2012-09-17 12:13:12 +02:00
Janus Weil
aa6590cfbe re PR fortran/54594 ([OOP] Type-bound ASSIGNMENTs (elemental + array version) rejected as ambiguous)
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/54594
	* gfortran.dg/typebound_generic_14.f03: New.

From-SVN: r191365
2012-09-16 22:49:20 +02:00
Mikael Morin
2a573572eb gfortran.h (gfc_get_proc_ptr_comp): New prototype.
fortran/
	* 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.

From-SVN: r190391
2012-08-14 16:28:29 +00:00
Janus Weil
edc802c796 re PR fortran/35831 ([F95] Shape mismatch check missing for dummy procedure argument)
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-06  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/35831
	* gfortran.dg/dummy_procedure_5.f90: Modified.
	* gfortran.dg/dummy_procedure_8.f90: New.
	* gfortran.dg/interface_26.f90: Modified.
	* gfortran.dg/proc_ptr_11.f90: Modified.
	* gfortran.dg/proc_ptr_15.f90: Modified.
	* gfortran.dg/proc_ptr_result_5.f90: Modified.
	* gfortran.dg/typebound_override_1.f90: Modified.
	* gfortran.dg/typebound_proc_6.f03: Modified.

From-SVN: r190187
2012-08-06 22:36:16 +02:00
Tobias Burnus
f8552cd47a interface.c (gfc_procedure_use): Return gfc_try instead of
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-31  Tobias Burnus  <burnus@net-b.de>

        * gfortran.dg/c_funloc_tests_6.f90: New.
        * gfortran.dg/c_funloc_tests_7.f90: New.
        * gfortran.dg/c_funloc_tests_5.f03: Compile with -std=f2003.

From-SVN: r190003
2012-07-31 12:06:24 +02:00
Tobias Burnus
62732c3044 trans-types.c (gfc_real16_is_float128): Fix spelling in a comment.
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.

From-SVN: r189859
2012-07-25 20:04:25 +02:00
Tobias Burnus
c62c6622bc re PR fortran/48820 (TR 29113: Implement parts needed for MPI 3)
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-20 07:56:37 +02:00
Tobias Burnus
99091b7039 interface.c (compare_parameter, [...]): Fix handling of polymorphic arguments.
2012-07-19  Tobias Burnus  <burnus@net-b.de>

        * interface.c (compare_parameter, compare_actual_formal): Fix
        handling of polymorphic arguments.

From-SVN: r189669
2012-07-19 19:39:49 +02:00
Janus Weil
9717f7a145 re PR fortran/51081 ([F03] Proc-pointer assignment: Rejects valid internal proc)
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.

From-SVN: r189589
2012-07-17 23:51:20 +02:00
Steven Bosscher
953bee7c4a gfortran.h: Do not include coretypes.h here.
* 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-07-08 09:55:02 +00:00
Janus Weil
362aa47460 re PR fortran/41951 ([OOP] Not diagnosing ambiguous operators (TB vs. INTERFACE))
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-27  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41951
	PR fortran/49591
	* gfortran.dg/typebound_operator_16.f03: New.

From-SVN: r189022
2012-06-27 19:38:00 +02:00
Janus Weil
6f3ab30d8b re PR fortran/47710 ([OOP] Improve ambiguity check for GENERIC TBP w/ PASS and NOPASS)
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-22  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/47710
	PR fortran/53328
	* gfortran.dg/typebound_generic_12.f03: New.
	* gfortran.dg/typebound_generic_13.f03: New.

From-SVN: r188902
2012-06-22 23:05:51 +02:00
Tobias Burnus
bcb4ad361c re PR fortran/52864 (Assignment to pointer component for INTENT(IN) dummy argument)
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-05-03  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52864
        * gfortran.dg/pointer_intent_7.f90: New.
        * gfortran.dg/pure_formal_3.f90: New.

From-SVN: r187076
2012-05-03 09:18:56 +02:00
Tobias Burnus
cdd244b832 re PR fortran/52916 (481.wrf in SPEC CPU 2006 failed to build)
2012-04-14  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-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52916
        PR fortran/40973
        * gfortran.dg/public_private_module_3.f90: New.
        * gfortran.dg/public_private_module_4.f90: New.

From-SVN: r186464
2012-04-15 07:52:51 +02:00
Tobias Burnus
45a6932568 re PR fortran/48820 (TR 29113: Implement parts needed for MPI 3)
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-03  Tobias Burnus  <burnus@net-b.de>

        PR fortran/48820
        * gfortran.dg/assumed_type_1.f90: New.
        * gfortran.dg/assumed_type_2.f90: New.
        * gfortran.dg/assumed_type_3.f90: New.
        * gfortran.dg/assumed_type_4.f90: New.

From-SVN: r184852
2012-03-03 09:40:24 +01:00
Tobias Burnus
f18075fff5 re PR fortran/52270 ([OOP] Polymorphic vars: wrong intent(in) check, passing nonptr variable to intent(in) ptr dummy)
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/52270
        * gfortran.dg/class_51.f90: New.

From-SVN: r184784
2012-03-02 14:07:46 +01:00
Tobias Burnus
d2c5dbf264 re PR fortran/52295 (Allow internal procedure in generic interfaces)
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-18  Tobias Burnus  <burnus@net-b.de>

        PR fortran/52295
        * gfortran.dg/interface_35.f90: Use -std=f2003.
        * gfortran.dg/proc_ptr_comp_20.f90: Remove dg-warning.
        * gfortran.dg/interface_assignment_4.f90: Ditto.
        * gfortran.dg/bessel_1.f90: Ditto.
        * gfortran.dg/func_result_6.f90: Ditto.
        * gfortran.dg/hypot_1.f90: Ditto.
        * gfortran.dg/proc_ptr_comp_21.f90: Ditto.

From-SVN: r184372
2012-02-18 13:31:42 +01:00
Tobias Burnus
b5912b1013 re PR translation/52273 (translatable string typo: "at at %L")
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".


Co-Authored-By: Roland Stigge <stigge@antcom.de>

From-SVN: r184334
2012-02-17 14:05:48 +01:00
Tobias Burnus
0c133211da re PR translation/52232 (translatable string typos: "conindexed" (should be "coindexed"))
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-17  Tobias Burnus  <burnus@net-b.de>

        PR translation/52232
        PR translation/52234
        PR translation/52245
        PR translation/52246
        PR translation/52262
        PR translation/52273
        * gfortran.dg/coarray_22.f90: Update dg-error.
        * gfortran.dg/allocate_alloc_opt_4.f90: Ditto.


Co-Authored-By: Roland Stigge <stigge@antcom.de>

From-SVN: r184331
2012-02-17 11:51:10 +01:00
Tobias Burnus
076ec830bf re PR fortran/51913 ([OOP] bug when submitting a class pointer to a subroutine)
2012-01-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51913
        * interface.c (compare_parameter): Fix CLASS comparison.

2012-01-21  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51913
        * gfortran.dg/class_47.f90: New.

From-SVN: r183368
2012-01-21 16:12:31 +01:00
Paul Thomas
efd2e969f2 re PR fortran/51791 ([OOP] Failure to resolve typebound function call with base object in parentheses.)
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  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/51791
	* gfortran.dg/typebound_operator_7.f03: Insert parentheses
	around base object in first assignment in main program.
	* gfortran.dg/typebound_operator_10.f03: New test.

From-SVN: r183032
2012-01-09 20:25:55 +00:00
Paul Thomas
94fae14bf8 re PR fortran/51529 ([OOP] gfortran.dg/class_to_type_1.f03 is miscompiled: Uninitialized variable used)
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  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/46262
	PR fortran/46328
	PR fortran/51052
	* gfortran.dg/typebound_operator_7.f03: New.
	* gfortran.dg/typebound_operator_8.f03: New.

From-SVN: r182796
2012-01-02 12:46:08 +00:00
Paul Thomas
c49ea23d52 re PR fortran/41539 ([OOP] Calling function which takes CLASS: Rank 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-11 20:42:23 +00:00
Tobias Burnus
c3f3495248 re PR fortran/39427 (F2003: Procedures with same name as types/type constructors)
gcc/fortran
2011-11-16  Tobias Burnus  <burnus@net-b.de>

        PR fortran/39427
        PR fortran/37829
        * decl.c (match_data_constant, match_data_constant,
        * variable_decl,
        gfc_match_decl_type_spec, access_attr_decl,
        check_extended_derived_type, gfc_match_derived_decl,
        gfc_match_derived_decl, gfc_match_derived_decl) Modified to deal
        with DT constructors.
        * gfortran.h (gfc_find_dt_in_generic,
        gfc_convert_to_structure_constructor): New function prototypes.
        * interface.c (check_interface0, check_interface1,
        gfc_search_interface): Ignore DT constructors in generic list.
        * match.h (gfc_match_structure_constructor): Update prototype.
        * match.c (match_derived_type_spec): Ensure that one uses the DT
        not the generic function.
        * module.c (MOD_VERSION): Bump.
        (dt_lower_string, dt_upper_string): New functions.
        (find_use_name_n, find_use_operator, compare_true_names,
        find_true_name, add_true_name, fix_mio_expr, load_needed,
        read_module, write_dt_extensions, write_symbol): Changes to deal with
        different symtree vs. sym names.
        (create_derived_type): Create also generic procedure.
        * parse.c (gfc_fixup_sibling_symbols): Don't regard DT and
        * generic
        function as the same.
        * primary.c (gfc_convert_to_structure_constructor): New
        * function.
        (gfc_match_structure_constructor): Restructured; calls
        gfc_convert_to_structure_constructor.
        (build_actual_constructor, gfc_match_rvalue): Update for DT generic
        functions.
        * resolve.c (resolve_formal_arglist, resolve_structure_cons,
        is_illegal_recursion, resolve_generic_f, resolve_variable,
        resolve_fl_variable_derived, resolve_fl_derived0,
        resolve_symbol): Handle DT and DT generic constructors.
        * symbol.c (gfc_use_derived, gfc_undo_symbols,
        gen_special_c_interop_ptr, gen_cptr_param,
        generate_isocbinding_symbol, gfc_get_derived_super_type): Handle
        derived-types, which are hidden in the generic type.
        (gfc_find_dt_in_generic): New function
        * trans-array.c (gfc_conv_array_initializer): Replace
        * FL_PARAMETER
        expr by actual value.
        * trans-decl.c (gfc_get_module_backend_decl,
        * gfc_trans_use_stmts):
        Ensure that we use the DT and not the generic function.
        * trans-types.c (gfc_get_derived_type): Ensure that we use the
        * DT
        and not the generic procedure.

gcc/testsuite/
2011-11-16  Tobias Burnus  <burnus@net-b.de>

        PR fortran/39427
        PR fortran/37829
        * gfortran.dg/constructor_1.f90: New.
        * gfortran.dg/constructor_2.f90: New.
        * gfortran.dg/constructor_3.f90: New.
        * gfortran.dg/constructor_4.f90: New.
        * gfortran.dg/constructor_5.f90: New.
        * gfortran.dg/constructor_6.f90: New.
        * gfortran.dg/use_only_5.f90: New.
        * gfortran.dg/c_ptr_tests_17.f90: New.
        * gfortran.dg/c_ptr_tests_18.f90: New.
        * gfortran.dg/used_types_25.f90: New.
        * gfortran.dg/used_types_26.f90: New
        * gfortran.dg/type_decl_3.f90: New.
        * gfortran.dg/function_types_3.f90: Update dg-error.
        * gfortran.dg/result_1.f90: Ditto.
        * gfortran.dg/structure_constructor_3.f03: Ditto.
        * gfortran.dg/structure_constructor_4.f03: Ditto.

From-SVN: r181425
2011-11-16 22:37:43 +01:00
Janus Weil
eaee02a520 gfortran.h (gfc_extend_expr): Modified prototype.
2011-11-06  Janus Weil  <janus@gcc.gnu.org>

	* gfortran.h (gfc_extend_expr): Modified prototype.
	* interface.c (gfc_extend_expr): Return 'match' instead of 'gfc_try'.
	Remove argument 'real_error'.
	* resolve.c (resolve_operator): Modified call to 'gfc_extend_expr'.

From-SVN: r181044
2011-11-06 22:36:54 +01:00
Tobias Burnus
a9e88ec6fe re PR fortran/50933 (Wrongly regards BIND(C) types as incompatible)
2011-11-03  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50933
        * interface.c (gfc_compare_derived_types): Fix check for
        * BIND(C).

2011-11-03  Tobias Burnus  <burnus@net-b.de>

        PR fortran/50933
        * gfortran.dg/bind_c_dts_5.f90: New.

From-SVN: r180879
2011-11-03 23:36:11 +01:00
Mikael Morin
46a9f26bd3 interface.c (check_dummy_characteristics): Count dimensions starting from one in diagnostic.
* interface.c (check_dummy_characteristics): Count dimensions starting
	from one in diagnostic.

From-SVN: r179726
2011-10-09 16:19:06 +00:00
Janus Weil
97f2673267 re PR fortran/35831 ([F95] Shape mismatch check missing for dummy procedure argument)
2011-10-04  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/35831
	* interface.c (check_dummy_characteristics): Check the array shape.


2011-10-04  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/35831
	* gfortran.dg/dummy_procedure_6.f90: New.

From-SVN: r179520
2011-10-04 20:37:13 +02:00
Janus Weil
e323640fb2 re PR fortran/50585 (ICE with assumed length character array argument)
2011-10-01  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/50585
	* interface.c (get_expr_storage_size): Check if 'length' component is
	associated.


2011-10-01  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/50585
	* gfortran.dg/assumed_charlen_arg_2.f90: New.

From-SVN: r179413
2011-10-01 13:41:41 +02:00
Janus Weil
ef71fdd925 re PR fortran/50515 (gfortran should not accept an external that is a common (r178939))
2011-09-26  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/50515
	* resolve.c (resolve_common_blocks): Check for EXTERNAL attribute.

	PR fortran/50517
	* interface.c (gfc_compare_interfaces): Bugfix in check for result type.


2011-09-26  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/50515
	* gfortran.dg/common_15.f90: New.

	PR fortran/50517
	* gfortran.dg/dummy_procedure_5.f90: New.
	* gfortran.dg/interface_26.f90: Modified error message.
	* gfortran.dg/proc_ptr_11.f90: Ditto.
	* gfortran.dg/proc_ptr_15.f90: Ditto.
	* gfortran.dg/proc_ptr_comp_20.f90: Ditto.
	* gfortran.dg/proc_ptr_result_5.f90: Ditto.

From-SVN: r179213
2011-09-26 22:05:43 +02:00
Janus Weil
58c1ae3667 re PR fortran/41733 (Proc-pointer conformance checks: Elemental-proc-ptr => non-elemental-proc)
2011-09-22  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41733
	* expr.c (gfc_check_pointer_assign): Check for nonintrinsic elemental
	procedures.
	* interface.c (gfc_compare_interfaces): Rename 'intent_flag'. Check
	for PURE and ELEMENTAL attributes.
	(compare_actual_formal): Remove pureness check here.


2011-09-22  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/41733
	* gfortran.dg/impure_actual_1.f90: Modified error message.
	* gfortran.dg/proc_ptr_32.f90: New.
	* gfortran.dg/proc_ptr_33.f90: New.

From-SVN: r179080
2011-09-22 11:32:11 +02:00
Tobias Burnus
ea8ad3e527 re PR fortran/34547 (NULL(): Fortran 2003 changes, accepts invalid, ICE on invalid)
2011-09-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34547
        PR fortran/50375
        * check.c (gfc_check_null): Allow allocatables as MOLD to NULL.
        * resolve.c (resolve_transfer): Reject NULL without MOLD.
        * interface.c (gfc_procedure_use): Reject NULL without MOLD
        if no explicit interface is known.
        (gfc_search_interface): Reject NULL without MOLD if it would
        lead to ambiguity.

2011-09-14  Tobias Burnus  <burnus@net-b.de>

        PR fortran/34547
        PR fortran/50375
        * gfortran.dg/null_5.f90: New.
        * gfortran.dg/null_6.f90: New.

From-SVN: r178841
2011-09-14 08:26:07 +02:00
Janus Weil
9795c59419 re PR fortran/35831 ([F95] Shape mismatch check missing for dummy procedure argument)
2011-09-11  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/35831
	PR fortran/47978
	* interface.c (check_dummy_characteristics): New function to check the
	characteristics of dummy arguments.
	(gfc_compare_interfaces,gfc_check_typebound_override): Call it here.


2011-09-11  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/35831
	PR fortran/47978
	* gfortran.dg/dynamic_dispatch_5.f03: Fix invalid test case.
	* gfortran.dg/proc_decl_26.f90: New.
	* gfortran.dg/typebound_override_2.f90: New.
	* gfortran.dg/typebound_proc_6.f03: Changed wording in error message.

From-SVN: r178767
2011-09-11 22:12:24 +02:00
Janus Weil
13001f33ca re PR fortran/49638 ([OOP] length parameter is ignored when overriding type bound character functions with constant length.)
2011-08-20  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/49638
	* dependency.c (gfc_dep_compare_expr): Add new result value "-3".
	(gfc_check_element_vs_section,gfc_check_element_vs_element): Handle
	result value "-3".
        * frontend-passes.c (optimize_comparison): Ditto.
	* interface.c (gfc_check_typebound_override): Ditto.


2011-08-20  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/49638
	* gfortran.dg/typebound_override_1.f90: Modified.

From-SVN: r177932
2011-08-20 21:11:56 +02:00
Janus Weil
2240d1cfe8 re PR fortran/49638 ([OOP] length parameter is ignored when overriding type bound character functions with constant length.)
2011-08-07  Janus Weil  <janus@gcc.gnu.org>
	    Thomas Koenig  <tkoenig@gcc.gnu.org>

	PR fortran/49638
	* dependency.c (are_identical_variables): For dummy arguments only
	check for equal names, not equal symbols.
	* interface.c (gfc_check_typebound_override): Add checking for rank
	and character length.

2011-08-07  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/49638
	* gfortran.dg/typebound_override_1.f90: New.

Co-Authored-By: Thomas Koenig <tkoenig@gcc.gnu.org>

From-SVN: r177550
2011-08-07 22:59:16 +02:00
Janus Weil
99fc1b90cd re PR fortran/49638 ([OOP] length parameter is ignored when overriding type bound character functions with constant length.)
2011-08-07  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/49638
	* dependency.h (gfc_is_same_range,gfc_are_identical_variables): Remove
	two prototypes.
	* dependency.c (gfc_are_identical_variables,are_identical_variables):
	Renamed the former to the latter and made static.
	(gfc_dep_compare_expr): Renamed 'gfc_are_identical_variables', handle
	commutativity of multiplication.
	(gfc_is_same_range,is_same_range): Renamed the former to the latter,
	made static and removed argument 'def'.
	(check_section_vs_section): Renamed 'gfc_is_same_range'.
	* gfortran.h (gfc_check_typebound_override): New prototype.
	* interface.c (gfc_check_typebound_override): Moved here from ...
	* resolve.c (check_typebound_override): ... here (and renamed).
	(resolve_typebound_procedure): Renamed 'check_typebound_override'.

From-SVN: r177545
2011-08-07 12:12:09 +02:00
Tobias Burnus
394d3a2e8d expr.c (gfc_is_coarray): New function.
2011-07-19  Tobias Burnus  <burnus@net-b.de>

        * expr.c (gfc_is_coarray): New function.
        * gfortran.h (gfc_is_coarray): New prototype.
        * interface.c (compare_parameter): Use it.

2011-07-19  Tobias Burnus  <burnus@net-b.de>

        * gfortran.dg/coarray_args_1.f90: New.
        * gfortran.dg/coarray_args_2.f90: New.

From-SVN: r176467
2011-07-19 18:46:02 +02:00
Tobias Burnus
fea549356d re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])
2011-06-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/18918
        * gfortran.h (gfc_check_vardef_context): Update prototype.
        (iso_fortran_env_symbol): Handle derived types.
        (symbol_attribute): Add lock_comp.
        * expr.c (gfc_check_vardef_context): Add LOCK_TYPE check.
        * interface.c (compare_parameter, gfc_procedure_use): Handle
        LOCK_TYPE.
        (compare_actual_formal): Update
        gfc_check_vardef_context call.
        * check.c (gfc_check_atomic_def, gfc_check_atomic_ref): Ditto.
        * intrinsic.c (check_arglist): Ditto.
        * io.c (resolve_tag, gfc_resolve_dt, gfc_resolve_inquire):
        * Ditto.
        * iso-fortran-env.def (ISOFORTRAN_LOCK_TYPE): Add.
        * intrinsic.texi (ISO_FORTRAN_ENV): Document LOCK_TYPE.
        * module.c (mio_symbol_attribute): Handle lock_comp.
        (create_derived_type): New function.
        (use_iso_fortran_env_module): Call it to handle LOCK_TYPE.
        * parse.c (parse_derived): Add constraint check for LOCK_TYPE.
        * resolve.c (resolve_symbol, resolve_lock_unlock): Add
        * constraint
        checks for LOCK_TYPE.
        (gfc_resolve_iterator, resolve_deallocate_expr,
        resolve_allocate_expr, resolve_code, resolve_transfer): Update
        gfc_check_vardef_context call.
        * trans-stmt.h (gfc_trans_lock_unlock): New prototype.
        * trans-stmt.c (gfc_trans_lock_unlock): New function.
        * trans.c (trans_code): Handle LOCK and UNLOCK.

2011-06-20  Tobias Burnus  <burnus@net-b.de>

        PR fortran/18918
        * gfortran.dg/coarray_lock_1.f90: Update dg-error.
        * gfortran.dg/coarray_lock_3.f90: New.
        * gfortran.dg/coarray/lock_1.f90: New.

From-SVN: r175228
2011-06-20 23:12:39 +02:00
Janus Weil
67a7c837e9 re PR fortran/49074 ([OOP] Defined assignment w/ CLASS arrays: Incomplete error message)
2011-06-16  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/49074
	* interface.c (gfc_extend_assign): Propagate the locus from the
	assignment to the type-bound procedure call.

2011-06-16  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/49074
	* gfortran.dg/typebound_assignment_3.f03: New.

From-SVN: r175113
2011-06-16 23:45:26 +02:00