aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
AgeCommit message (Collapse)AuthorFilesLines
2013-09-25re PR fortran/57697 ([OOP] Segfault with defined assignment for components ↵Tobias Burnus1-11/+28
during intrinsic assignment) 2013-09-25 Tobias Burnus <burnus@net-b.de> PR fortran/57697 PR fortran/58469 * resolve.c (generate_component_assignments): Avoid double free at runtime and freeing a still-being used expr. 2013-09-25 Tobias Burnus <burnus@net-b.de> PR fortran/57697 PR fortran/58469 * gfortran.dg/defined_assignment_8.f90: New. * gfortran.dg/defined_assignment_9.f90: New. From-SVN: r202922
2013-09-18re PR fortran/43366 ([OOP][F08] Intrinsic assign to polymorphic variable)Tobias Burnus1-7/+29
2013-09-15 Tobias Burnus <burnus@net-b.de> PR fortran/43366 * primary.c (gfc_variable_attr): Also handle codimension. * resolve.c (resolve_ordinary_assign): Add invalid-diagnostic * for polymorphic assignment. 2013-09-15 Tobias Burnus <burnus@net-b.de> PR fortran/43366 * gfortran.dg/class_39.f03: Update dg-error. * gfortran.dg/class_5.f03: Ditto. * gfortran.dg/class_53.f90: Ditto. * gfortran.dg/realloc_on_assign_20.f90: New. * gfortran.dg/realloc_on_assign_21.f90: New. * gfortran.dg/realloc_on_assign_22.f90: New. From-SVN: r202713
2013-09-16re PR fortran/57697 ([OOP] Segfault with defined assignment for components ↵Tobias Burnus1-11/+15
during intrinsic assignment) 2013-09-16 Tobias Burnus <burnus@net-b.de> PR fortran/57697 * resolve.c (generate_component_assignments): Correctly handle * the case that the LHS is not allocated. 2013-09-16 Tobias Burnus <burnus@net-b.de> PR fortran/57697 * gfortran.dg/defined_assignment_10.f90: Comment print * statement. From-SVN: r202609
2013-09-15re PR fortran/57697 ([OOP] Segfault with defined assignment for components ↵Tobias Burnus1-0/+40
during intrinsic assignment) 2013-09-15 Tobias Burnus <burnus@net-b.de> PR fortran/57697 * resolve.c (generate_component_assignments): Handle unallocated LHS with defined assignment of components. 2013-09-15 Tobias Burnus <burnus@net-b.de> PR fortran/57697 * gfortran.dg/defined_assignment_10.f90: New. From-SVN: r202601
2013-09-02PR fortran/PR56519Thomas Koenig1-9/+9
2013-09-02 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/PR56519 * gfortran.h: Declare gfc_do_concurrent_flag as extern. * resolve.c: Rename do_concurrent_flag to gfc_do_concurrent_flag and make non-static. (resolve_function): Use gfc_do_concurrent_flag instead of do_concurrent_flag. (pure_subroutine): Likewise. (resolve_code): Likewise. (resolve_types): Likewise. * intrinsic.c (gfc_intrinsic_sub_interface): Raise error for non-pure intrinsic subroutines within DO CONCURRENT. 2013-09-02 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/PR56519 * gfortran.dg/do_concurrent_3.f90: New test case. From-SVN: r202188
2013-08-12re PR fortran/56666 (Suppression flag for " DO loop at (1) will be executed ↵Thomas Koenig1-2/+4
zero times") 2013-08-12 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/56666 * gfortran.h (gfc_option_t): Add warn_zerotrip. * invoke.texi (-Wzerotrip): Document option. * lang.opt (Wzerotrip): Add. * options.c (gfc_init_options): Initialize warn_zerotrip. (set_Wall): Add handling of warn_zerotrip. (gfc_handle_option): Handle OPT_Wzerotrip. * resolve.c (gfc_resolve_iterator): Honor gfc_option.warn_zerotrip; update error message to show how to suppress the warning. 2013-08-12 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/56666 * gfortran.dg/do_check_10.f90: New test. * gfortran.dg/array_constructor_11.f90: Add -Wzerotrip to dg-options. * gfortran.dg/array_constructor_18.f90: Likewise. * gfortran.dg/array_constructor_22.f90: Likewise. * gfortran.dg/coarray_15.f90: Likewise. * gfortran.dg/do_1.f90: Add -Wall to dg-options. * gfortran.dg/do_3.F90: Add -Wzerotrip to dg-options. * gfortran.dg/do_check_5.f90: Add -Wall to gd-options. From-SVN: r201658
2013-08-09gfortran.h (gfc_get_code): Modified prototype.Janus Weil1-20/+10
2013-08-09 Janus Weil <janus@gcc.gnu.org> * gfortran.h (gfc_get_code): Modified prototype. * class.c (finalize_component, finalization_scalarizer, finalization_get_offset, finalizer_insert_packed_call, generate_finalization_wrapper, gfc_find_derived_vtab, gfc_find_intrinsic_vtab): Use 'gfc_get_code'. * io.c (match_io_iterator, match_io_element, terminate_io, get_io_list, gfc_match_inquire): Call 'gfc_get_code' with argument. * match.c (match_simple_forall, gfc_match_forall, gfc_match_goto, gfc_match_nullify, gfc_match_call, match_simple_where, gfc_match_where): Ditto. * parse.c (new_level): Ditto. (add_statement): Use XCNEW. * resolve.c (resolve_entries, resolve_allocate_expr, resolve_select_type, build_assignment, build_init_assign): Call 'gfc_get_code' with argument. * st.c (gfc_get_code): Add argument 'op'. * trans-expr.c (gfc_trans_class_array_init_assign): Call 'gfc_get_code' with argument. * trans-stmt.c (gfc_trans_allocate): Ditto. From-SVN: r201635
2013-07-29match.c (gfc_match_call): Exit loop after setting i.Po-Chun Chang1-1/+4
* match.c (gfc_match_call): Exit loop after setting i. * resolve.c (resolve_variable): Exit loop after setting seen. * expr.c (gfc_check_pointer_assign): Exit loop after setting * warn. * trans-array.c (set_loop_bounds): Exit loop after setting nonoptional_arr. * trans-io.c (gfc_trans_transfer): Exit loop after setting * seen_vector. From-SVN: r201316
2013-07-25re PR fortran/57966 ([OOP] Using a TBP to specify the shape of a dummy argument)Janus Weil1-0/+5
2013-07-25 Janus Weil <janus@gcc.gnu.org> PR fortran/57966 * resolve.c (resolve_typebound_function): Make sure the declared type, including its type-bound procedures, is resolved before resolving the actual type-bound call. 2013-07-25 Janus Weil <janus@gcc.gnu.org> PR fortran/57966 * gfortran.dg/typebound_call_25.f90: New. From-SVN: r201254
2013-07-15trans-array.h (gfc_deallocate_alloc_comp_no_caf, [...]): New prototype.Tobias Burnus1-2/+2
2013-07-15 Tobias Burnus <burnus@net-b.de> * trans-array.h (gfc_deallocate_alloc_comp_no_caf, gfc_reassign_alloc_comp_caf): New prototype. * trans-array.c (enum): Add DEALLOCATE_ALLOC_COMP_NO_CAF and COPY_ALLOC_COMP_CAF. (structure_alloc_comps): Handle it. (gfc_reassign_alloc_comp_caf, gfc_deallocate_alloc_comp_no_caf): New function. (gfc_alloc_allocatable_for_assignment): Call it. * trans-expr.c (gfc_trans_scalar_assign, gfc_trans_arrayfunc_assign, gfc_trans_assignment_1): Ditto. * parse.c (parse_derived): Correctly set coarray_comp. * resolve.c (resolve_symbol): Improve error wording. 2013-07-15 Tobias Burnus <burnus@net-b.de> * gfortran.dg/coarray_lib_realloc_1.f90: New. * gfortran.dg/coarray/lib_realloc_1.f90: New. * gfortran.dg/coarray_6.f90: Add dg-error. From-SVN: r200955
2013-06-20resolve.c (get_temp_from_expr): Don't set FL_VARIABLE twice.Tobias Burnus1-1/+0
2013-06-20 Tobias Burnus <burnus@net-b.de> * resolve.c (get_temp_from_expr): Don't set FL_VARIABLE twice. From-SVN: r200234
2013-06-14re PR fortran/57508 ([OOP] Intrinsic assignment+defined-assignment for ↵Tobias Burnus1-0/+4
comps: PROCEDURE attribute of '_F.DA0' conflicts with VARIABLE attribute) 2013-06-14 Tobias Burnus <burnus@net-b.de> PR fortran/57508 * resolve.c (get_temp_from_expr): Don't copy function result attributes to temporary. 2013-06-14 Tobias Burnus <burnus@net-b.de> PR fortran/57508 * gfortran.dg/defined_assignment_7.f90: New. From-SVN: r200089
2013-05-30re PR fortran/54189 (ICE (segfault) with invalid assumed-size dummy)Janus Weil1-1/+1
2013-05-30 Janus Weil <janus@gcc.gnu.org> PR fortran/54189 * resolve.c (check_assumed_size_reference): Check for e->ref. 2013-05-30 Janus Weil <janus@gcc.gnu.org> PR fortran/54189 * gfortran.dg/assumed_size_1.f90: New. From-SVN: r199445
2013-05-28re PR fortran/37336 ([F03] Finish derived-type finalization)Tobias Burnus1-4/+0
2013-05-28 Tobias Burnus <burnus@net-b.de> PR fortran/37336 * resolve.c (gfc_resolve_finalizers): Remove not implemented * error. 2013-05-28 Tobias Burnus <burnus@net-b.de> PR fortran/37336 * gfortran.dg/finalize_11.f90: New. * gfortran.dg/finalize_4.f03: Remove dg-error. * gfortran.dg/finalize_5.f03: Ditto. * gfortran.dg/finalize_6.f03: Ditto. * gfortran.dg/finalize_7.f03: Ditto. From-SVN: r199388
2013-05-27re PR fortran/50405 (allocation LOOP or SIGSEGV)Bud Davis1-0/+8
2013-05-27 Bud Davis <jmdavis@link.com> PR fortran/50405 * resolve.c (resolve_formal_arglist): Detect error when an * argument has the same name as the function. 2013-05-27 Bud Davis <jmdavis@link.com> PR fortran/50405 * gfortran.dg/stfunc_8.f90: New. From-SVN: r199358
2013-05-22resolve.c (get_temp_from_expr): Change mangling to start always with a _.Tobias Burnus1-1/+1
2013-05-22 Tobias Burnus <burnus@net-b.de> * resolve.c (get_temp_from_expr): Change mangling to start always with a _. From-SVN: r199215
2013-05-22resolve.c (get_temp_from_expr): Fix temp var mangling.Tobias Burnus1-1/+1
2013-05-22 Tobias Burnus <burnus@net-b.de> * resolve.c (get_temp_from_expr): Fix temp var mangling. From-SVN: r199214
2013-05-22re PR fortran/57364 ([OOP] ICE gfc_enforce_clean_symbol_state)Tobias Burnus1-0/+1
2013-05-22 Tobias Burnus <burnus@net-b.de> PR fortran/57364 * resolve.c (get_temp_from_expr): Commit created sym. 2013-05-22 Tobias Burnus <burnus@net-b.de> PR fortran/57364 * gfortran.dg/defined_assignment_6.f90: New. From-SVN: r199196
2013-05-20re PR fortran/48858 (Incorrect error for same binding label on two generic ↵Tobias Burnus1-75/+81
interface specifics) 2013-05-20 Tobias Burnus <burnus@net-b.de> PR fortran/48858 PR fortran/55465 * decl.c (add_global_entry): Add sym_name. * parse.c (add_global_procedure): Ditto. * resolve.c (resolve_bind_c_derived_types): Handle multiple decl for a procedure. (resolve_global_procedure): Handle gsym->ns pointing to a module. * trans-decl.c (gfc_get_extern_function_decl): Ditto. 2013-05-20 Tobias Burnus <burnus@net-b.de> PR fortran/48858 PR fortran/55465 * gfortran.dg/binding_label_tests_10_main.f03: Update dg-error. * gfortran.dg/binding_label_tests_11_main.f03: Ditto. * gfortran.dg/binding_label_tests_13_main.f03: Ditto. * gfortran.dg/binding_label_tests_3.f03: Ditto. * gfortran.dg/binding_label_tests_4.f03: Ditto. * gfortran.dg/binding_label_tests_5.f03: Ditto. * gfortran.dg/binding_label_tests_6.f03: Ditto. * gfortran.dg/binding_label_tests_7.f03: Ditto. * gfortran.dg/binding_label_tests_8.f03: Ditto. * gfortran.dg/c_loc_tests_12.f03: Fix test case. * gfortran.dg/binding_label_tests_24.f90: New. * gfortran.dg/binding_label_tests_25.f90: New. From-SVN: r199120
2013-05-20re PR fortran/48858 (Incorrect error for same binding label on two generic ↵Tobias Burnus1-1/+1
interface specifics) 2013-05-20 Tobias Burnus <burnus@net-b.de> PR fortran/48858 * decl.c (add_global_entry): Use nonbinding name only for F2003 or if no binding label exists. (gfc_match_entry): Update calls. * parse.c (gfc_global_used): Improve error message. (add_global_procedure): Use nonbinding name only for F2003 or if no binding label exists. (gfc_parse_file): Update call. * resolve.c (resolve_global_procedure): Use binding name when available. * trans-decl.c (gfc_get_extern_function_decl): Ditto. 2013-05-20 Tobias Burnus <burnus@net-b.de> PR fortran/48858 * gfortran.dg/binding_label_tests_17.f90: New. * gfortran.dg/binding_label_tests_18.f90: New. * gfortran.dg/binding_label_tests_19.f90: New. * gfortran.dg/binding_label_tests_20.f90: New. * gfortran.dg/binding_label_tests_21.f90: New. * gfortran.dg/binding_label_tests_22.f90: New. * gfortran.dg/binding_label_tests_23.f90: New. From-SVN: r199119
2013-05-20re PR fortran/48858 (Incorrect error for same binding label on two generic ↵Tobias Burnus1-100/+79
interface specifics) 2013-05-20 Tobias Burnus <burnus@net-b.de> PR fortran/48858 * decl.c (gfc_match_bind_c_stmt): Add gfc_notify_std. * match.c (gfc_match_common): Don't add commons to gsym. * resolve.c (resolve_common_blocks): Add to gsym and add checks. (resolve_bind_c_comms): Remove. (resolve_types): Remove call to the latter. * trans-common.c (gfc_common_ns): Remove static var. (gfc_map_of_all_commons): Add static var. (build_common_decl): Correctly handle binding label. 2013-05-20 Tobias Burnus <burnus@net-b.de> PR fortran/48858 * gfortran.dg/test_common_binding_labels.f03: Update dg-error. * gfortran.dg/test_common_binding_labels_2_main.f03: Ditto. * gfortran.dg/test_common_binding_labels_3_main.f03: Ditto. * gfortran.dg/common_18.f90: New. * gfortran.dg/common_19.f90: New. * gfortran.dg/common_20.f90: New. * gfortran.dg/common_21.f90: New. From-SVN: r199118
2013-05-05resolve.c (conformable_arrays): Avoid segfault when ar.start[i] == NULL.Tobias Burnus1-0/+3
2013-05-05 Tobias Burnus <burnus@net-b.de> * resolve.c (conformable_arrays): Avoid segfault when ar.start[i] == NULL. 2013-05-05 Tobias Burnus <burnus@net-b.de> * gfortran.dg/allocate_with_source_3.f90: New. From-SVN: r198610
2013-05-02re PR fortran/57142 (SIZE/SHAPE overflow despite kind=8)Tobias Burnus1-0/+1
2013-05-02 Tobias Burnus <burnus@net-b.de> PR fortran/57142 * simplify.c (gfc_simplify_size): Renamed from simplify_size; fix kind=8 handling. (gfc_simplify_size): New function. (gfc_simplify_shape): Add range check. * resolve.c (resolve_function): Fix handling for ISYM_SIZE. 2013-05-02 Tobias Burnus <burnus@net-b.de> PR fortran/57142 * gfortran.dg/size_kind_2.f90: New. * gfortran.dg/size_kind_3.f90: New. From-SVN: r198549
2013-04-18expr.c (find_array_element): Don't copy expr.Tobias Burnus1-0/+2
2013-04-18 Tobias Burnus <burnus@net-b.de> * expr.c (find_array_element): Don't copy expr. * data.c (create_character_initializer): Free expr. * frontend-passes.c (combine_array_constructor): Ditto. * match.c (match_typebound_call, gfc_match_select_type): Ditto. * resolve.c (resolve_typebound_function): Free gfc_ref. From-SVN: r198068
2013-04-16re PR fortran/39505 (Consider a 'no arg check' directive)Tobias Burnus1-10/+87
2013-04-12 Tobias Burnus <burnus@net-b.de> PR fortran/39505 * decl.c (ext_attr_list): Add EXT_ATTR_NO_ARG_CHECK. * gfortran.h (ext_attr_id_t): Ditto. * gfortran.texi (GNU Fortran Compiler Directives): Document it. * interface.c (compare_type_rank): Ignore rank for NO_ARG_CHECK. (compare_parameter): Ditto - and regard as unlimited polymorphic. * resolve.c (resolve_symbol, resolve_variable): Add same * constraint checks as for TYPE(*); turn dummy to TYPE(*),dimension(*). (gfc_explicit_interface_required): Require explicit interface for NO_ARG_CHECK. 2013-04-12 Tobias Burnus <burnus@net-b.de> PR fortran/39505 * gfortran.dg/no_arg_check_1.f90: New. * gfortran.dg/no_arg_check_2.f90: New. * gfortran.dg/no_arg_check_3.f90: New. From-SVN: r198011
2013-04-15class.c (gfc_find_intrinsic_vtab): Removed unused var.Tobias Burnus1-0/+2
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-12re PR fortran/56261 ([OOP] seg fault call procedure pointer on polymorphic ↵Janus Weil1-149/+143
array) 2013-04-12 Janus Weil <janus@gcc.gnu.org> PR fortran/56261 * gfortran.h (gfc_explicit_interface_required): New prototype. * expr.c (gfc_check_pointer_assign): Check if an explicit interface is required in a proc-ptr assignment. * interface.c (check_result_characteristics): Extra check. * resolve.c (gfc_explicit_interface_required): New function. (resolve_global_procedure): Use new function 'gfc_explicit_interface_required'. Do a full interface check. 2013-04-12 Janus Weil <janus@gcc.gnu.org> PR fortran/56261 * gfortran.dg/auto_char_len_4.f90: Add -pedantic. Changed error. * gfortran.dg/assumed_rank_4.f90: Modified error wording. * gfortran.dg/block_11.f90: Fix invalid test case. * gfortran.dg/function_types_3.f90: Add new error message. * gfortran.dg/global_references_1.f90: Ditto. * gfortran.dg/import2.f90: Remove unneeded parts. * gfortran.dg/import6.f90: Fix invalid test case. * gfortran.dg/proc_decl_2.f90: Ditto. * gfortran.dg/proc_decl_9.f90: Ditto. * gfortran.dg/proc_decl_18.f90: Ditto. * gfortran.dg/proc_ptr_40.f90: New. * gfortran.dg/whole_file_7.f90: Modified error wording. * gfortran.dg/whole_file_16.f90: Ditto. * gfortran.dg/whole_file_17.f90: Add -pedantic. * gfortran.dg/whole_file_18.f90: Modified error wording. * gfortran.dg/whole_file_20.f03: Ditto. * gfortran.fortran-torture/execute/intrinsic_associated.f90: Fix invalid test case. From-SVN: r197922
2013-04-11Replace enum gfc_try with bool type.Janne Blomqvist1-873/+853
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-25re PR fortran/38536 (ICE with C_LOC in resolve.c due to not properly going ↵Tobias Burnus1-587/+25
through expr->ref) 2013-03-25 Tobias Burnus <burnus@net-b.de> PR fortran/38536 PR fortran/38813 PR fortran/38894 PR fortran/39288 PR fortran/40963 PR fortran/45824 PR fortran/47023 PR fortran/47034 PR fortran/49023 PR fortran/50269 PR fortran/50612 PR fortran/52426 PR fortran/54263 PR fortran/55343 PR fortran/55444 PR fortran/55574 PR fortran/56079 PR fortran/56378 * check.c (gfc_var_strlen): Properly handle 0-sized string. (gfc_check_c_sizeof): Use is_c_interoperable, add checks. (is_c_interoperable, gfc_check_c_associated, gfc_check_c_f_pointer, gfc_check_c_f_procpointer, gfc_check_c_funloc, gfc_check_c_loc): New functions. * expr.c (check_inquiry): Add c_sizeof, compiler_version and compiler_options. (gfc_check_pointer_assign): Refine function result check. gfortran.h (gfc_isym_id): Add GFC_ISYM_C_ASSOCIATED, GFC_ISYM_C_F_POINTER, GFC_ISYM_C_F_PROCPOINTER, GFC_ISYM_C_FUNLOC, GFC_ISYM_C_LOC. (iso_fortran_env_symbol, iso_c_binding_symbol): Handle NAMED_SUBROUTINE. (generate_isocbinding_symbol): Update prototype. (get_iso_c_sym): Remove. (gfc_isym_id_by_intmod, gfc_isym_id_by_intmod_sym): New prototypes. * intrinsic.c (gfc_intrinsic_subroutine_by_id): New function. (gfc_intrinsic_sub_interface): Use it. (add_functions, add_subroutines): Add missing C-binding intrinsics. (gfc_intrinsic_func_interface): Add special case for c_loc. gfc_isym_id_by_intmod, gfc_isym_id_by_intmod_sym): New functions. (gfc_intrinsic_func_interface, gfc_intrinsic_sub_interface): Use them. * intrinsic.h (gfc_check_c_associated, gfc_check_c_f_pointer, gfc_check_c_f_procpointer, gfc_check_c_funloc, gfc_check_c_loc, gfc_resolve_c_loc, gfc_resolve_c_funloc): New prototypes. * iresolve.c (gfc_resolve_c_loc, gfc_resolve_c_funloc): New functions. * iso-c-binding.def: Split PROCEDURE into NAMED_SUBROUTINE and NAMED_FUNCTION. * iso-fortran-env.def: Add NAMED_SUBROUTINE for completeness. * module.c (create_intrinsic_function): Support subroutines and derived-type results. (use_iso_fortran_env_module): Update calls. (import_iso_c_binding_module): Ditto; update calls to generate_isocbinding_symbol. * resolve.c (find_arglists): Skip for intrinsic symbols. (gfc_resolve_intrinsic): Find intrinsic subs via id. (is_scalar_expr_ptr, gfc_iso_c_func_interface, set_name_and_label, gfc_iso_c_sub_interface): Remove. (resolve_function, resolve_specific_s0): Remove calls to those. (resolve_structure_cons): Fix handling. * symbol.c (gen_special_c_interop_ptr): Update c_ptr/c_funptr generation. (gen_cptr_param, gen_fptr_param, gen_shape_param, build_formal_args, get_iso_c_sym): Remove. (std_for_isocbinding_symbol): Handle NAMED_SUBROUTINE. (generate_isocbinding_symbol): Support hidden symbols and using c_ptr/c_funptr symtrees for nullptr defs. * target-memory.c (gfc_target_encode_expr): Fix handling of c_ptr/c_funptr. * trans-expr.c (conv_isocbinding_procedure): Remove. (gfc_conv_procedure_call): Remove call to it. (gfc_trans_subcomponent_assign, gfc_conv_expr): Update handling of c_ptr/c_funptr. * trans-intrinsic.c (conv_isocbinding_function, conv_isocbinding_subroutine): New. (gfc_conv_intrinsic_function, gfc_conv_intrinsic_subroutine): Call them. * trans-io.c (transfer_expr): Fix handling of c_ptr/c_funptr. * trans-types.c (gfc_typenode_for_spec, gfc_get_derived_type): Ditto. (gfc_init_c_interop_kinds): Handle NAMED_SUBROUTINE. 2013-03-25 Tobias Burnus <burnus@net-b.de> PR fortran/38536 PR fortran/38813 PR fortran/38894 PR fortran/39288 PR fortran/40963 PR fortran/45824 PR fortran/47023 PR fortran/47034 PR fortran/49023 PR fortran/50269 PR fortran/50612 PR fortran/52426 PR fortran/54263 PR fortran/55343 PR fortran/55444 PR fortran/55574 PR fortran/56079 PR fortran/56378 * gfortran.dg/c_assoc_2.f03: Update dg-error wording. * gfortran.dg/c_f_pointer_shape_test.f90: Ditto. * gfortran.dg/c_f_pointer_shape_tests_3.f03: Ditto. * gfortran.dg/c_f_pointer_tests_5.f90: Ditto. * gfortran.dg/c_funloc_tests_2.f03: Ditto. * gfortran.dg/c_funloc_tests_5.f03: Ditto. * gfortran.dg/c_funloc_tests_6.f90: Ditto. * gfortran.dg/c_loc_tests_10.f03: Add -std=f2008. * gfortran.dg/c_loc_tests_11.f03: Ditto, update dg-error. * gfortran.dg/c_loc_tests_16.f90: Ditto. * gfortran.dg/c_loc_tests_4.f03: Ditto. * gfortran.dg/c_loc_tests_15.f90: Update dg-error wording. * gfortran.dg/c_loc_tests_3.f03: Valid since F2003 TC5. * gfortran.dg/c_loc_tests_8.f03: Ditto. * gfortran.dg/c_ptr_tests_14.f90: Update scan-tree-dump-times. * gfortran.dg/c_ptr_tests_15.f90: Ditto. * gfortran.dg/c_sizeof_1.f90: Fix invalid code. * gfortran.dg/iso_c_binding_init_expr.f03: Update dg-error wording. * gfortran.dg/pr32601_1.f03: Ditto. * gfortran.dg/storage_size_2.f08: Remove dg-error. * gfortran.dg/blockdata_7.f90: New. * gfortran.dg/c_assoc_4.f90: New. * gfortran.dg/c_f_pointer_tests_6.f90: New. * gfortran.dg/c_f_pointer_tests_7.f90: New. * gfortran.dg/c_funloc_tests_8.f90: New. * gfortran.dg/c_loc_test_17.f90: New. * gfortran.dg/c_loc_test_18.f90: New. * gfortran.dg/c_loc_test_19.f90: New. * gfortran.dg/c_loc_test_20.f90: New. * gfortran.dg/c_sizeof_5.f90: New. * gfortran.dg/iso_c_binding_rename_3.f90: New. * gfortran.dg/transfer_resolve_2.f90: New. * gfortran.dg/transfer_resolve_3.f90: New. * gfortran.dg/transfer_resolve_4.f90: New. * gfortran.dg/pr32601.f03: Update dg-error. * gfortran.dg/c_ptr_tests_13.f03: Update dg-error. * gfortran.dg/c_ptr_tests_9.f03: Fix test case. From-SVN: r197053
2013-03-18gfortran.h (gfc_option_t): Remove flag_whole_file.Tobias Burnus1-10/+9
2013-03-18 Tobias Burnus <burnus@net-b.de> * gfortran.h (gfc_option_t): Remove flag_whole_file. * invoke.texi (-fno-whole-file): Remove. * lang.opt (fwhole-file): Change to Ignore. * options.c (gfc_init_options, gfc_post_options, gfc_handle_option): Remove !flag_whole_file handling * parse.c (resolve_all_program_units, * translate_all_program_units, gfc_parse_file): Ditto. * resolve.c (resolve_global_procedure): Ditto. * trans-decl.c (gfc_get_symbol_decl, * gfc_get_extern_function_decl, gfc_create_module_variable): Ditto. * trans-types.c (gfc_get_derived_type): Ditto. From-SVN: r196773
2013-03-10re PR fortran/56575 (An invalid OO code causes ICE)Paul Thomas1-0/+2
2013-03-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/56575 * expr.c (gfc_default_initializer): Check that a class declared type has any components. * resolve.c (resolve_fl_derived0): On failing the test for C437 set the type to BT_UNKNOWN to prevent repeat error messages. 2013-03-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/56575 * gfortran.dg/class_56.f90: New test. From-SVN: r196580
2013-02-24resolve.c (generate_component_assignments): Don't use UTF-8 ligature in ↵Joseph Myers1-1/+1
diagnostic. * resolve.c (generate_component_assignments): Don't use UTF-8 ligature in diagnostic. From-SVN: r196242
2013-02-15re PR fortran/53818 (-finit-local-zero -fno-automatic: Function result ↵Tobias Burnus1-2/+3
cannot have initializer) 2013-02-15 Tobias Burnus <burnus@net-b.de> PR fortran/53818 * resolve.c (apply_default_init_local): Don't create an initializer for a result variable. 2013-02-15 Tobias Burnus <burnus@net-b.de> PR fortran/53818 * gfortran.dg/init_flag_11.f90: New. From-SVN: r196073
2013-02-12re PR fortran/46952 ([OOP] Spurious "recursive call" error with type bound ↵Janus Weil1-19/+21
procedure) 2013-02-12 Janus Weil <janus@gcc.gnu.org> PR fortran/46952 * resolve.c (resolve_call): Do not check deferred procedures for recursiveness. 2013-02-12 Janus Weil <janus@gcc.gnu.org> PR fortran/46952 * gfortran.dg/typebound_deferred_1.f90: New. From-SVN: r195975
2013-02-04re PR fortran/54195 ([OOP] IMPORT fails with GENERIC TBP: "is already ↵Mikael Morin1-1/+1
present in the interface") fortran/ PR fortran/54195 * resolve.c (resolve_typebound_procedures): Recurse through resolve_symbol. testsuite/ PR fortran/54195 * gfortran.dg/typebound_operator_19.f90: New test. * gfortran.dg/typebound_assignment_4.f90: New test. From-SVN: r195730
2013-02-04re PR fortran/54107 ([F03] Memory hog with abstract interface)Mikael Morin1-6/+4
fortran/ PR fortran/54107 PR fortran/54195 * gfortran.h (struct gfc_symbol): New field 'resolved'. * resolve.c (resolve_fl_var_and_proc): Don't skip result symbols. (resolve_symbol): Skip duplicate calls. Don't check the current namespace. testsuite/ PR fortran/54107 * gfortran.dg/recursive_interface_1.f90: New test. From-SVN: r195729
2013-01-29re PR fortran/54107 ([F03] Memory hog with abstract interface)Janus Weil1-49/+39
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-27[multiple changes]Paul Thomas1-0/+7
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-23re PR fortran/56081 (Seg fault ICE on select with bad case)Janus Weil1-4/+15
2013-01-23 Janus Weil <janus@gcc.gnu.org> PR fortran/56081 * resolve.c (resolve_select): Add argument 'select_type', reject non-scalar expressions. (resolve_select_type,resolve_code): Pass new argument to 'resolve_select'. 2013-01-23 Janus Weil <janus@gcc.gnu.org> PR fortran/56081 * gfortran.dg/select_8.f90: New. From-SVN: r195412
2013-01-10Update copyright years in gcc/Richard Sandiford1-3/+1
From-SVN: r195098
2013-01-09re PR fortran/55758 (LOGICAL and BIND(C): Reject kind=2/4/8/16 with ↵Tobias Burnus1-0/+26
-std=f2008, improve warning, switch to nonBOOLEAN_TYPE for those) 2013-01-09 Tobias Burnus <burnus@net-b.de> PR fortran/55758 * resolve.c (resolve_symbol): Reject non-C_Bool logicals in BIND(C) procedures with -std=f*. 2013-01-09 Tobias Burnus <burnus@net-b.de> PR fortran/55758 * gfortran.dg/bind_c_bool_1.f90: New. * gfortran.dg/do_5.f90: Add dg-warning. From-SVN: r195055
2013-01-07re PR fortran/55763 (Issues with some simpler CLASS(*) programs)Tobias Burnus1-9/+18
2013-01-07 Tobias Burnus <burnus@net-b.de> PR fortran/55763 * gfortran.h (gfc_check_assign_symbol): Update prototype. * decl.c (add_init_expr_to_sym, do_parm): Update call. * expr.c (gfc_check_assign_symbol): Handle BT_CLASS and improve error location; support components. (gfc_check_pointer_assign): Handle component assignments. * resolve.c (resolve_fl_derived0): Call gfc_check_assign_symbol. (resolve_values): Update call. (resolve_structure_cons): Avoid double diagnostic. 2013-01-07 Tobias Burnus <burnus@net-b.de> PR fortran/55763 * gfortran.dg/pointer_init_2.f90: Update dg-error. * gfortran.dg/pointer_init_7.f90: New. From-SVN: r194990
2013-01-07re PR fortran/55763 (Issues with some simpler CLASS(*) programs)Tobias Burnus1-5/+9
2012-01-07 Tobias Burnus <burnus@net-b.de> PR fortran/55763 * resolve.c (resolve_select_type): Reject intrinsic types for a non-unlimited-polymorphic selector. 2012-01-07 Tobias Burnus <burnus@net-b.de> PR fortran/55763 * gfortran.dg/select_type_32.f90: New. From-SVN: r194962
2013-01-06re PR fortran/42769 ([OOP] ICE in resolve_typebound_procedure)Mikael Morin1-1/+1
PR fortran/42769 PR fortran/45836 PR fortran/45900 * module.c (read_module): Don't reuse local symtree if the associated symbol isn't exactly the one wanted. Don't reuse local symtree if it is ambiguous. * resolve.c (resolve_call): Use symtree's name instead of symbol's to lookup the symtree. PR fortran/42769 PR fortran/45836 PR fortran/45900 * gfortran.dg/use_23.f90: New test. * gfortran.dg/use_24.f90: New test. * gfortran.dg/use_25.f90: New test. * gfortran.dg/use_26.f90: New test. * gfortran.dg/use_27.f90: New test. From-SVN: r194949
2013-01-04re PR fortran/55172 ([OOP] gfc_variable_attr(): Bad array reference in ↵Paul Thomas1-2/+20
SELECT TYPE) 2013-01-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/55172 * match.c (copy_ts_from_selector_to_associate): Remove call to gfc_resolve_expr and replace it with explicit setting of the array reference type. * resolve.c (resolve_select_type): It is an error if the selector is coindexed. 2013-01-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/55172 * gfortran.dg/select_type_31.f03: New test. From-SVN: r194916
2012-12-23re PR fortran/54884 (Externally used PRIVATE module procedure wrongly marked ↵Tobias Burnus1-20/+0
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-22re PR fortran/55763 (Issues with some simpler CLASS(*) programs)Tobias Burnus1-1/+1
2012-12-21 Tobias Burnus <burnus@net-b.de> PR fortran/55763 * module.c (mio_component): Don't skip _hash's initializer. * resolve.c (resolve_select_type): Add an assert. * trans-expr.c (gfc_conv_procedure_call): Handle INTENT(OUT) for UNLIMIT_POLY. 2012-12-21 Tobias Burnus <burnus@net-b.de> PR fortran/55763 * gfortran.dg/unlimited_polymorphic_6.f90: New. From-SVN: r194696
2012-12-21re PR fortran/55763 (Issues with some simpler CLASS(*) programs)Paul Thomas1-3/+4
2012-12-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/55763 * match.c (select_type_set_tmp): Return is a derived type or class typespec has no derived type. * resolve.c (resolve_fl_var_and_proc): Exclude select type temporaries from 'pointer'. (resolve_symbol): Exclude select type temporaries from tests for assumed size and assumed rank. 2012-12-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/55763 * gfortran.dg/unlimited_polymorphic_4.f03: New test. From-SVN: r194663
2012-12-20array.c (resolve_array_list): Apply C4106.Paul Thomas1-11/+96
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-16re PR fortran/55638 (Wrongly accepts INTENT + VALUE - and wrongly requires ↵Tobias Burnus1-2/+4
it for PURE) 2012-12-16 Tobias Burnus <burnus@net-b.de> PR fortran/55638 * resolve.c (resolve_formal_arglist): Allow VALUE without INTENT for ELEMENTAL procedures. 2012-12-16 Tobias Burnus <burnus@net-b.de> PR fortran/55638 * gfortran.dg/elemental_args_check_3.f90: Update dg-error. * gfortran.dg/elemental_args_check_7.f90: New. From-SVN: r194525