aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/interface.c
AgeCommit message (Collapse)AuthorFilesLines
2018-06-24re PR fortran/85983 (ICE in check_dtio_interface1, at fortran/interface.c:4748)Jerry DeLisle1-1/+0
2018-06-23 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/85983 * interface.c (check_dtio_interface1): Delete assert. From-SVN: r261994
2018-06-11re PR fortran/45521 ([F08] GENERIC resolution with ALLOCATABLE/POINTER and ↵Janus Weil1-4/+22
PROCEDURE) 2018-06-11 Janus Weil <janus@gcc.gnu.org> PR fortran/45521 * interface.c (compare_ptr_alloc): New function. (generic_correspondence): Call it. 2018-06-11 Janus Weil <janus@gcc.gnu.org> PR fortran/45521 * gfortran.dg/generic_32.f90: New test. * gfortran.dg/generic_33.f90: New test. From-SVN: r261448
2018-03-21re PR fortran/85001 (ICE in gfc_build_array_type, at fortran/trans-types.c:1420)Steven G. Kargl1-1/+1
2018-03-20 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/85001 * interface.c (symbol_rank): Remove bogus null pointer check that crept in when translating a ternary operator into an if-else constructor. 2018-03-20 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/85001 * gfortran.dg/interface_41.f90: New test. From-SVN: r258698
2018-02-23re PR fortran/84346 (Statement functions should not accept keywords)Steven G. Kargl1-0/+7
2018-02-23 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/84346 * interface.c (compare_actual_formal): Issue error if keyword is used in a statement function. 2018-02-23 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/84346 * gfortran.dg/statement_function_1.f90: Update test. From-SVN: r257942
2018-02-15re PR fortran/84409 ([F03] check DTIO arguments for character len)Janus Weil1-1/+5
2018-02-15 Janus Weil <janus@gcc.gnu.org> PR fortran/84409 * interface.c (check_dtio_arg_TKR_intent): Add a check for character length. 2018-02-15 Janus Weil <janus@gcc.gnu.org> PR fortran/84409 * gfortran.dg/dtio_21.f03: Add an error message. * gfortran.dg/dtio_22.f90: Fix invalid test case. From-SVN: r257711
2018-02-11re PR fortran/54223 (Statement function statement with dummy arguments that ↵Steven G. Kargl1-10/+15
are also OPTIONAL may crash in wrong calls) 2018-02-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/54223 PR fortran/84276 * interface.c (compare_actual_formal): Add in_statement_function bool parameter. Skip check of INTENT attribute for statement functions. Arguments to a statement function cannot be optional, issue error for missing argument. (gfc_procedure_use, gfc_ppc_use, gfc_arglist_matches_symbol): Use in_statement_function. 2018-02-11 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/54223 PR fortran/84276 * gfortran.dg/statement_function_1.f90: New test. * gfortran.dg/statement_function_2.f90: New test. From-SVN: r257565
2018-01-16re PR fortran/82257 (f951: Internal compiler error segmentation fault)Louis Krupp1-2/+6
2018-01-15 Louis Krupp <louis.krupp@zoho.com> PR fortran/82257 * interface.c (compare_rank): Don't try to retrieve CLASS_DATA from symbol marked unlimited polymorphic. * resolve.c (resolve_structure_cons): Likewise. * misc.c (gfc_typename): Don't dereference derived->components if it's NULL. 2018-01-15 Louis Krupp <louis.krupp@zoho.com> PR fortran/82257 * gfortran.dg/unlimited_polymorphic_28.f90: New test. From-SVN: r256720
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-12-17Support -std=f2018Janne Blomqvist1-1/+1
The Fortran committee has decided to rename the upcoming Fortran 2015 standard to Fortran 2018. This is not a reflection of a three year delay in the process, but rather they are following other standards in adopting the year of publication for the name. For more details see N2144. This patch renames GFC_STD_F2015 to GFC_STD_F2018, and makes it a separate flag rather than an alias for GFC_STD_GNU. Also, it adds a -std=f2018 argument, and documents it. Regtested on x86_64-pc-linux-gnu. gcc/fortran/ChangeLog: 2017-12-17 Janne Blomqvist <jb@gcc.gnu.org> * decl.c (gfc_match_implicit_none): Use GFC_STD_F2018 instead of GFC_STD_F2015. * error.c (gfc_notify_std): Add GFC_STD_F2018{_DEL,_OBS} to switch. * gfortran.texi: Document -std=f2018. * interface.c (compare_parameter): Fix comment. * invoke.texi: Document -std=f2018. * lang.opt: Add -std=f2018 argumnet. * libgfortran.h (GFC_STD_F2015): Rename to GFC_STD_F0218, use separate flag bit. (GFC_STD_F2018_DEL): New macro. (GFC_STD_F2018_OBS): Likewise. * match.c (gfc_match_stopcode): Use GFC_STD_F2018. * options.c (set_default_std_flags): Add F2018 flags to defaults. (gfc_handle_option): Set options for -std=f2018. gcc/testsuite/ChangeLog: 2017-12-17 Janne Blomqvist <jb@gcc.gnu.org> * gfortran.dg/error_stop_3.f90: Update -std= option, fix comments. * gfortran.dg/error_stop_4.f90: Update error message. * gfortran.dg/implicit_14.f90: Likewise. * gfortran.dg/spellcheck-procedure_2.f90: Don't warn for F2018 features. From-SVN: r255761
2017-11-09re PR fortran/78814 (ICE in symbol_rank, at fortran/interface.c:1265)Steven G. Kargl1-2/+7
2017-11-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/78814 * interface.c (symbol_rank): Check for NULL pointer. 2017-11-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/78814 * gfortran.dg/interface_40.f90: New testcase. From-SVN: r254604
2017-10-19Derive interface buffers from max name lengthBernhard Reutner-Fischer1-3/+3
2017-10-19 Bernhard Reutner-Fischer <aldot@gcc.gnu.org> * interface.c (check_sym_interfaces, check_uop_interfaces, gfc_check_interfaces): Base interface_name buffer off GFC_MAX_SYMBOL_LEN. From-SVN: r253881
2017-10-19Use Levenshtein spelling suggestions in Fortran FEBernhard Reutner-Fischer1-9/+63
gcc/fortran/ChangeLog 2017-10-19 Bernhard Reutner-Fischer <aldot@gcc.gnu.org> * gfortran.h (gfc_lookup_function_fuzzy): New declaration. (gfc_closest_fuzzy_match): New declaration. (vec_push): New definition. * misc.c (gfc_closest_fuzzy_match): New definition. * resolve.c: Include spellcheck.h. (lookup_function_fuzzy_find_candidates): New static function. (lookup_uop_fuzzy_find_candidates): Likewise. (lookup_uop_fuzzy): Likewise. (resolve_operator) <INTRINSIC_USER>: Call lookup_uop_fuzzy. (gfc_lookup_function_fuzzy): New definition. (resolve_unknown_f): Call gfc_lookup_function_fuzzy. * interface.c (check_interface0): Likewise. (lookup_arg_fuzzy_find_candidates): New static function. (lookup_arg_fuzzy ): Likewise. (compare_actual_formal): Call lookup_arg_fuzzy. * symbol.c: Include spellcheck.h. (lookup_symbol_fuzzy_find_candidates): New static function. (lookup_symbol_fuzzy): Likewise. (gfc_set_default_type): Call lookup_symbol_fuzzy. (lookup_component_fuzzy_find_candidates): New static function. (lookup_component_fuzzy): Likewise. (gfc_find_component): Call lookup_component_fuzzy. gcc/testsuite/ChangeLog 2017-10-19 Bernhard Reutner-Fischer <aldot@gcc.gnu.org> * gfortran.dg/spellcheck-operator.f90: New testcase. * gfortran.dg/spellcheck-procedure_1.f90: New testcase. * gfortran.dg/spellcheck-procedure_2.f90: New testcase. * gfortran.dg/spellcheck-structure.f90: New testcase. * gfortran.dg/spellcheck-parameter.f90: New testcase. From-SVN: r253877
2017-09-29re PR fortran/25071 (dummy argument larger than actual argument)Dominique d'Humieres1-5/+14
2017-09-29 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/25071 * interface.c (compare_actual_formal): Change warnings to errors when "Actual argument contains too few elements for dummy argument", unless -std=legacy is used. From-SVN: r253286
2017-09-09decl.c: Add decl_type_param_list...Paul Thomas1-1/+2
2017-09-09 Paul Thomas <pault@gcc.gnu.org> * decl.c : Add decl_type_param_list, type_param_spec_list as static variables to hold PDT spec lists. (build_sym): Copy 'type_param_spec_list' to symbol spec_list. (build_struct): Copy the 'saved_kind_expr' to the component 'kind_expr'. Check that KIND or LEN components appear in the decl_type_param_list. These should appear as symbols in the f2k_derived namespace. If the component is itself a PDT type, copy the decl_type_param_list to the component param_list. (gfc_match_kind_spec): If the KIND expression is parameterized set KIND to zero and store the expression in 'saved_kind_expr'. (insert_parameter_exprs): New function. (gfc_insert_kind_parameter_exprs): New function. (gfc_insert_parameter_exprs): New function. (gfc_get_pdt_instance): New function. (gfc_match_decl_type_spec): Match the decl_type_spec_list if it is present. If it is, call 'gfc_get_pdt_instance' to obtain the specific instance of the PDT. (match_attr_spec): Match KIND and LEN attributes. Check for the standard and for type/kind of the parameter. They are also not allowed outside a derived type definition. (gfc_match_data_decl): Null the decl_type_param_list and the type_param_spec_list on entry and free them on exit. (gfc_match_formal_arglist): If 'typeparam' is true, add the formal symbol to the f2k_derived namespace. (gfc_match_derived_decl): Register the decl_type_param_list if this is a PDT. If this is a type extension, gather up all the type parameters and put them in the right order. *dump-parse-tree.c (show_attr): Signal PDT templates and the parameter attributes. (show_components): Output parameter atrributes and component parameter list. (show_symbol): Show variable parameter lists. * expr.c (expr.c): Copy the expression parameter list. (gfc_is_constant_expr): Pass on symbols representing PDT parameters. (gfc_check_init_expr): Break on PDT KIND parameters and PDT parameter expressions. (gfc_check_assign): Assigning to KIND or LEN components is an error. (derived_parameter_expr): New function. (gfc_derived_parameter_expr): New function. (gfc_spec_list_type): New function. * gfortran.h : Add enum gfc_param_spec_type. Add the PDT attrs to the structure symbol_attr. Add the 'kind_expr' and 'param_list' field to the gfc_component structure. Comment on the reuse of the gfc_actual_arglist structure as storage for type parameter spec lists. Add the new field 'spec_type' to this structure. Add 'param_list' fields to gfc_symbol and gfc_expr. Add prototypes for gfc_insert_kind_parameter_exprs, gfc_insert_parameter_exprs, gfc_add_kind, gfc_add_len, gfc_derived_parameter_expr and gfc_spec_list_type. * interface.c (gfc_compare_derived_types): Treat PDTs in the same way as sequence types. * match.c : Add variable 'type_param_spec_list'. (gfc_op2string, gfc_match_member_sep, gfc_match_label): Remove trailing whitespace. (match_derived_type_spec): Match PDTs and find specific instance. (gfc_match_type_spec): Remove more trailing whitespace. (gfc_match_allocate): Assumed or deferred parameters cannot appear here. Copy the type parameter spec list to the expr for the allocatable entity. Free 'type_param_spec_list'. (gfc_match_common, gfc_match_namelist, gfc_match_module): Still more trailing whitespace to remove. (gfc_match_type_is): Allow PDT typespecs. * match.h : Modify prototypes for gfc_match_formal_arglist and gfc_match_actual_arglist. * module.c (ab_attribute, mstring attr_bits): PDT attributes added. (mio_symbol_attribute): PDT attributes handled. (mio_component): Deal with 'kind_expr' field. (mio_full_f2k_derived): For PDT templates, transfer the formal namespace symroot to the f2k_derived namespace. *primary.c (match_keyword_arg, gfc_match_actual_arglist): Add modifications to handle PDT spec lists. These are flagged in both cases by new boolean arguments, whose prototype defaults are false. (gfc_match_structure_constructor, match_variable): Remove yet more trailing whitespace. * resolve.c (get_pdt_spec_expr, get_pdt_constructor): New functions. (resolve_structure_cons): If the constructor is a PDT template, call get_pdt_constructor to build it using the parameter lists and then get the specific instance of the PDT. (resolve_component): PDT strings need a hidden string length component like deferred characters. (resolve_symbol): Dummy PDTs cannot have deferred parameters. * symbol.c (gfc_add_kind, gfc_add_len): New functions. (free_components): Free 'kind_expr' and 'param_list' fields. (gfc_free_symbol): Free the 'param_list' field. (gfc_find_sym_tree): If the current state is a PDT template, look for the symtree in the f2k_derived namspaces. trans-array.c (structure_alloc_comps): Allocate and deallocate PDTs. Check dummy arguments for compliance of LEN parameters. Add the new functions to the preceeding enum. (gfc_allocate_pdt_comp, gfc_deallocate_pdt_comp and gfc_check_pdt_dummy): New functions calling above. * trans-array.h : Add prototypes for these functions. trans-decl.c (gfc_get_symbol_decl): Call gfc_defer_symbol_init as appropriate for PDT symbols. (gfc_trans_deferred_vars): Allocate/deallocate PDT entities as they come into and out of scope. Exclude pdt_types from being 'gcc_unreachable'. (gfc_trans_subcomponent_assign): PDT array components must be handles as if they are allocatable. * trans-stmt.c (gfc_trans_allocate): Handle initialization of PDT entities. (gfc_trans_deallocate): Likewise. * trans-types.c (gfc_get_derived_type): PDT templates must not arrive here. PDT string components are handles as if deferred. Similarly, PDT arrays are treated as if allocatable. PDT strings are pointer types. * trans.c (gfc_deferred_strlen): Handle PDT strings in the same way as deferred characters. 2017-09-09 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/pdt_1.f03 : New test. * gfortran.dg/pdt_2.f03 : New test. * gfortran.dg/pdt_3.f03 : New test. * gfortran.dg/pdt_4.f03 : New test. * gfortran.dg/pdt_5.f03 : New test. From-SVN: r251925
2017-07-23fortran: fix pair_cmp qsort comparatorAlexander Monakov1-1/+3
* interface.c (pair_cmp): Fix gfc_symbol comparison. Adjust comment. From-SVN: r250463
2017-03-22re PR fortran/79602 (translation: globally replace '%s' with %qs)Dominique d'Humieres1-3/+3
2017-03-22 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/79602 * decl.c: Replace '%s' with %qs. * expr.c: Likewise. * interface.c: Likewise. * match.c: Likewise. * primary.c: Likewise. * resolve.c: Likewise. PR fortran/79844 PR fortran/80011 * io.c: Remove trailing spaces. * match.c: Likewise. * openmp.c: Likewise. * resolve.c: Likewise. * trans-intrinsic.c: Likewise. PR fortran/79853 * expr.c: Remove a double spaces. PR fortran/79859 * primary.c: Remove spurious quotes around %qs. From-SVN: r246391
2017-02-25re PR fortran/79597 (Incomplete error message "Expecting %<END INTERFACE ↵Dominique d'Humieres1-3/+3
OPERATOR") 2017-02-25 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/79597 * interface.c (gfc_match_end_interface): Remove spurious comma and space, replace 'got %s' with 'got %qs'. 2017-02-25 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/79597 * gfortran.dg/dtio_6.f90: Update test. 2017-02-25 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/79601 * interface.c (check_dtio_arg_TKR_intent): Change 'intent' to 'INTENT'. 2017-02-25 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/79601 * gfortran.dg/interface_operator_2.f90: New test. From-SVN: r245729
2017-02-20re PR fortran/79599 (typo in diagnostic gfc_error ("DTIO dummy argument at ↵Paul Thomas1-2/+2
%L be a scalar") 2017-02-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/79599 * interface.c (check_dtio_arg_TKR_intent): Supply 'must' missing from error message. 2017-02-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/79523 * interface.c (gfc_find_typebound_dtio_proc): Guard test for flavor attribute by checking that symbol is resolved. From-SVN: r245603
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-12-27gfortran.h (gfc_error): Rename overload with OPT argument to...Jakub Jelinek1-29/+21
* gfortran.h (gfc_error): Rename overload with OPT argument to... (gfc_error_opt): ... this. * error.c (gfc_error): Rename overloads with OPT argument to... (gfc_error_opt): ... this. Adjust callers. (gfc_notify_std, gfc_error): Adjust callers. * resolve.c (resolve_structure_cons, resolve_global_procedure): Use gfc_error_opt instead of gfc_error. * interface.c (argument_rank_mismatch, compare_parameter, gfc_check_typebound_override): Likewise. Fix up formatting. From-SVN: r243941
2016-12-18re PR fortran/78592 (ICE in gfc_find_specific_dtio_proc, at ↵Janus Weil1-9/+11
fortran/interface.c:4939) 2016-12-18 Janus Weil <janus@gcc.gnu.org> PR fortran/78592 * interfac.c (gfc_find_specific_dtio_proc): Fixup for r243005, making sure that the generic list is followed through until the end. 2016-12-18 Janus Weil <janus@gcc.gnu.org> PR fortran/78592 * gfortran.dg/dtio_21.f90: New test. From-SVN: r243783
2016-12-15re PR fortran/78798 ([cleanup] some int-valued functions should be bool)Janus Weil1-178/+175
2016-12-15 Janus Weil <janus@gcc.gnu.org> PR fortran/78798 * gfortran.h (gfc_compare_derived_types,gfc_compare_types, gfc_compare_interfaces,gfc_has_vector_subscript): Return bool instead of int. * interface.c (compare_components): Ditto. (gfc_compare_union_types): Rename to compare_union_types, declare as static, return bool. (gfc_compare_derived_types): Return bool instead of int. (gfc_compare_types): Ditto. (compare_type): Ditto. (compare_rank): Ditto. (compare_type_rank): Ditto. (compare_type_rank_if): Ditto. (count_types_test): Ditto. (generic_correspondence): Ditto. (gfc_compare_interfaces): Ditto. (check_interface0): Ditto. (check_interface1): Ditto. (compare_allocatable): Ditto. (compare_parameter): Ditto. (gfc_has_vector_subscript): Ditto. (compare_actual_formal): Ditto. From-SVN: r243726
2016-12-15re PR fortran/78800 ([OOP] ICE in compare_parameter, at ↵Janus Weil1-9/+10
fortran/interface.c:2246) 2016-12-15 Janus Weil <janus@gcc.gnu.org> PR fortran/78800 * interface.c (compare_allocatable): Avoid additional errors on bad class declarations. (compare_parameter): Put the result of gfc_expr_attr into a variable, in order to avoid calling it multiple times. Exit early on bad class declarations to avoid ICE. 2016-12-15 Janus Weil <janus@gcc.gnu.org> PR fortran/78800 * gfortran.dg/unlimited_polymorphic_27.f90: New test case. From-SVN: r243691
2016-12-14re PR fortran/78672 (Gfortran test suite failures with a sanitized compiler)Andre Vehreschild1-31/+38
gcc/fortran/ChangeLog: 2016-12-14 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/78672 * array.c (gfc_find_array_ref): Add flag to return NULL when no ref is found instead of erroring out. * data.c (gfc_assign_data_value): Only constant expressions are valid for initializers. * gfortran.h: Reflect change of gfc_find_array_ref's signature. * interface.c (compare_actual_formal): Access the non-elemental array-ref. Prevent taking a REF_COMPONENT for a REF_ARRAY. Correct indentation. * module.c (load_omp_udrs): Clear typespec before reading into it. * trans-decl.c (gfc_build_qualified_array): Prevent accessing the array when it is a coarray. * trans-expr.c (gfc_conv_cst_int_power): Use wi::abs()-function instead of crutch preventing sanitizer's bickering here. * trans-stmt.c (gfc_trans_deallocate): Only get data-component when it is a descriptor-array here. From-SVN: r243647
2016-12-13re PR fortran/78737 ([OOP] linking error with deferred, undefined ↵Janus Weil1-11/+21
user-defined derived-type I/O) 2016-12-13 Janus Weil <janus@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> PR fortran/78737 * gfortran.h (gfc_find_typebound_dtio_proc): New prototype. * interface.c (gfc_compare_interfaces): Whitespace fix. (gfc_find_typebound_dtio_proc): New function. (gfc_find_specific_dtio_proc): Use it. Improve error recovery. * trans-io.c (get_dtio_proc): Implement polymorphic calls to DTIO procedures. 2016-12-13 Janus Weil <janus@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> PR fortran/78737 * gfortran.dg/dtio_19.f90: New test case. Co-Authored-By: Paul Thomas <pault@gcc.gnu.org> From-SVN: r243609
2016-11-30re PR fortran/78592 (ICE in gfc_find_specific_dtio_proc, at ↵Janus Weil1-7/+7
fortran/interface.c:4939) 2016-11-30 Janus Weil <janus@gcc.gnu.org> PR fortran/78592 * interface.c (gfc_find_specific_dtio_proc): Rearrange code to avoid dereferencing a null pointer. 2016-11-30 Janus Weil <janus@gcc.gnu.org> PR fortran/78592 * gfortran.dg/dtio_18.f90: New test case. From-SVN: r243005
2016-11-25re PR fortran/60853 ([OOP] Failure to disambiguate generic with unlimited ↵Janus Weil1-9/+1
polymorphic) 2016-11-25 Janus Weil <janus@gcc.gnu.org> PR fortran/60853 * interface.c (gfc_compare_interfaces): Remove bad special case for unlimited polymorphism. Refactor for loop. 2016-11-25 Janus Weil <janus@gcc.gnu.org> PR fortran/60853 * gfortran.dg/typebound_assignment_8.f90: New test case. From-SVN: r242880
2016-11-24re PR fortran/78500 (ICE in gfc_check_vardef_context, at fortran/expr.c:5289)Steven G. Kargl1-1/+1
2016-11-24 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/78500 * expr.c (gfc_check_vardef_contextm): Fix NULL pointer dereference. * interface.c (matching_typebound_op): Ditto. 2016-11-24 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/78500 * gfortran.dg/class_result_4.f90: New test. From-SVN: r242846
2016-11-10Fix some whitespace.Fritz O. Reese1-32/+32
gcc/fortran/ * decl.c (get_struct_decl, gfc_match_map, gfc_match_union): Fix whitespace. * interface.c (gfc_compare_union_types): Likewise. From-SVN: r242057
2016-11-09[multiple changes]Janus Weil1-0/+2
2016-11-09 Mikael Morin <mikael@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org> PR fortran/46459 * interface.c (compare_actual_formal): Add safety checks to avoid ICE. 2016-11-09 Janus Weil <janus@gcc.gnu.org> PR fortran/46459 * gfortran.dg/volatile14.f90: New test. From-SVN: r242020
2016-11-02New warning -Wargument-mismatch for function argument mismatches.Fritz O. Reese1-11/+17
gcc/fortran/ * lang.opt, invoke.texi: New argument -Wargument-mismatch. * interface.c (compare_parameter, compare_actual_formal, gfc_check_typebound_override, argument_rank_mismatch): Control argument mismatch warnings with -Wargument-mismatch. * resolve.c (resolve_structure_cons, resolve_global_procedure): Ditto. gcc/testsuite/gfortran.dg/ * warn_argument_mismatch_1.f90: New test. From-SVN: r241795
2016-10-24re PR fortran/71895 (ICE in gfc_compare_derived_types, at ↵Steven G. Kargl1-1/+2
fortran/interface.c:520) 2016-10-24 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/71895 * interface.c (gfc_compare_derived_types): Convert gcc_assert() to a gfc_internal_error() to prevent an ICE. 2016-10-24 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/71895 * gfortran.dg/pr71895.f90: New test. From-SVN: r241493
2016-10-07Fix ICE due to map typespecs with different sized charlens being copied.Fritz Reese1-0/+11
2016-10-07 Fritz Reese <fritzoreese@gmail.com> Fix ICE due to map typespecs with different sized charlens being copied. gcc/fortran/ * interface.c (compare_components): Check charlen for BT_CHAR. gcc/testsuite/gfortran.dg/ * dec_union_11.f90: New testcase. From-SVN: r240875
2016-10-07re PR fortran/77406 (ICE in generic_correspondence, at fortran/interface.c:1123)Steven G. Kargl1-7/+18
2016-10-07 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77406 * interface.c (gfc_compare_interfaces): Fix detection of ambiguous interface involving alternate return. (check_interface1): Improve error message and loci. 2016-10-07 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77406 * gfortran.dg/pr77406.f90: New test. * gfortran.dg/assumed_type_3.f90: Update error messages. * gfortran.dg/defined_operators_1.f90: Ditto. * gfortran.dg/generic_26.f90: Ditto. * gfortran.dg/generic_7.f90: Ditto. * gfortran.dg/gomp/udr5.f90: Ditto. * gfortran.dg/gomp/udr7.f90: Ditto. * gfortran.dg/interface_1.f90: Ditto. * gfortran.dg/interface_37.f90: Ditto. * gfortran.dg/interface_5.f90: Ditto. * gfortran.dg/interface_6.f90: Ditto. * gfortran.dg/interface_7.f90 * gfortran.dg/no_arg_check_3.f90 * gfortran.dg/operator_5.f90 * gfortran.dg/proc_ptr_comp_20.f90: Ditto. From-SVN: r240870
2016-10-05Fix ICE due to comparison between UNION components.Fritz Reese1-5/+12
2016-10-05 Fritz Reese <fritzoreese@gmail.com> Fix ICE due to comparison between UNION components. gcc/fortran/ * interface.c (gfc_compare_types): Don't compare BT_UNION components until we know they're both UNIONs. * interface.c (gfc_compare_union_types): Guard against empty components. gcc/testsuite/gfortran.dg/ * dec_union_9.f90: New testcase. * dec_union_10.f90: New testcase. From-SVN: r240810
2016-09-30Fix ICE for maps with zero components.Fritz Reese1-4/+15
2016-09-30 Fritz Reese <fritzoreese@gmail.com> Fix ICE for maps with zero components. PR fortran/77764 * gcc/fortran/interface.c (gfc_compare_union_types): Null-guard map components. PR fortran/77764 * gcc/testsuite/gfortran.dg/dec_union_8.f90: New testcase. From-SVN: r240652
2016-09-30Fix ICE caused by union types comparing equal to structures.Fritz Reese1-0/+4
2016-09-30 Fritz Reese <fritzoreese@gmail.com> Fix ICE caused by union types comparing equal to structures. PR fortran/77782 * gcc/fortran/interface.c (gfc_compare_derived_types): Use gfc_compare_union_types to compare union types. PR fortran/77782 * gcc/testsuite/gfortran.dg/dec_structure_16.f90: New testcase. From-SVN: r240651
2016-09-27auto-inc-dec.c (try_merge): Remove break after return.Jakub Jelinek1-3/+0
* auto-inc-dec.c (try_merge): Remove break after return. * cselib.c (autoinc_split): Likewise. * explow.c (promote_mode): Likewise. * fixed-value.c (fixed_arithmetic): Likewise. * hsa.c (hsa_internal_fn::get_arity): Likewise. * rtlanal.c (modified_between_p, modified_in_p): Likewise. * trans-mem.c (get_attrs_for): Likewise. * tree-if-conv.c (if_convertible_stmt_p): Likewise. * tree-vrp.c (simplify_stmt_using_ranges): Likewise. * config/aarch64/aarch64-builtins.c (aarch64_fold_builtin): Likewise. * config/aarch64/aarch64.c (aarch64_get_condition_code_1): Likewise. * config/c6x/c6x.c (c6x_get_unit_specifier): Likewise. * config/cr16/cr16.c (legitimate_pic_operand_p): Likewise. * config/cris/cris.c (cris_op_str): Likewise. * config/mn10300/mn10300.c (cc_flags_for_code): Likewise. * config/tilepro/tilepro.c (tilepro_emit_setcc_internal_di): Likewise. c-family/ * c-ada-spec.c (print_ada_declaration): Remove break after return. objc/ * objc-act.c (continue_class): Remove break after return. (objc_maybe_printable_name): Likewise. fortran/ * dependency.c (gfc_dep_compare_expr): Remove break after return. * frontend-passes.c (optimize_op): Likewise. * interface.c (gfc_current_interface_head): Likewise. * symbol.c (check_conflict): Likewise. * trans-intrinsic.c (build_fix_expr): Likewise. ada/ * terminals.c (is_gui_app): Remove break after return. From-SVN: r240554
2016-09-26re PR fortran/48298 ([F03] User-Defined Derived-Type IO (DTIO))Paul Thomas1-0/+3
2016-09-26 Paul Thomas <pault@gcc.gnu.org> PR fortran/48298 * interface.c (gfc_find_specific_dtio_proc) : Return NULL if the derived type is broken, as indicated by a flavor other than FL_DERIVED. From-SVN: r240493
2016-09-22re PR fortran/48298 ([F03] User-Defined Derived-Type IO (DTIO))Paul Thomas1-1/+3
2016-09-22 Paul Thomas <pault@gcc.gnu.org> PR fortran/48298 * gfortran.h : Place the pseudo operators INTRINSIC_FORMATTED and INTRINSIC_UNFORMATTED after the sentinel in enum gfc_intrinsic_op so that they do not appear as place holders in module_write. * interface.c (dtio_op): Comment on the special nature of the pseudo operators INTRINSIC FORMATTED and INTRINSIC_UNFORMATTED. From-SVN: r240349
2016-09-22interface.c (check_dtio_interface1): Introduce errors for alternate returns ↵Paul Thomas1-2/+38
and incorrect numbers of arguments. 2016-09-22 Paul Thomas <pault@gcc.gnu.org> * interface.c (check_dtio_interface1): Introduce errors for alternate returns and incorrect numbers of arguments. (gfc_find_specific_dtio_proc): Return cleanly if the derived type either doesn't exist or has no namespace. 2016-09-22 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/dtio_11.f90: Correct for changed error messages. * gfortran.dg/dtio_13.f90: New test. From-SVN: r240342
2016-09-21re PR fortran/77657 (link error with implementation of user-defined derived ↵Paul Thomas1-1/+13
type input/output (UD-DTIO) in child extending abstract parent) 2016-09-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/77657 * interface.c (gfc_find_specific_dtio_proc): Borrow trick from resolve_typebound_generic_call to find dtio procedures that over-ride those in the declared type. 2016-09-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/77657 * gfortran.dg/dtio_12.f90: New test. From-SVN: r240301
2016-09-10re PR fortran/77532 ([F03] ICE in check_dtio_interface1, at ↵Paul Thomas1-6/+12
fortran/interface.c:4622) 2016-09-10 Paul Thomas <pault@gcc.gnu.org> Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77532 ^ interface.c (check_dtio_arg_TKR_intent): Return after error. (check_dtio_interface1): Remove asserts, test for NULL and return if found. gfortran.dg/dtio_11.f90: new test. Co-Authored-By: Steven G. Kargl <kargl@gcc.gnu.org> From-SVN: r240074
2016-08-31[multiple changes]Paul Thomas1-17/+376
2016-08-31 Paul Thomas <pault@gcc.gnu.org> Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/48298 * decl.c (access_attr_decl): Include case INTERFACE_DTIO as appropriate. * gfortran.h : Add INTRINSIC_FORMATTED and INTRINSIC_UNFORMATTED to gfc_intrinsic_op. Add INTERFACE_DTIO to interface type. Add new enum 'dtio_codes'. Add bitfield 'has_dtio_procs' to symbol_attr. Add prototypes 'gfc_check_dtio_interfaces' and 'gfc_find_specific_dtio_proc'. * interface.c (dtio_op): New function. (gfc_match_generic_spec): Match generic DTIO interfaces. (gfc_match_interface): Treat DTIO interfaces in the same way as (gfc_current_interface_head): Add INTERFACE_DTIO appropriately. (check_dtio_arg_TKR_intent): New function. (check_dtio_interface1): New function. (gfc_check_dtio_interfaces): New function. (gfc_find_specific_dtio_proc): New function. * io.c : Add FMT_DT to format_token. (format_lex): Handle DTIO formatting. * match.c (gfc_op2string): Add DTIO operators. * resolve.c (derived_inaccessible): Ignore pointer components to enclosing derived type. (resolve_transfer): Resolve transfers that involve DTIO. procedures. Find the specific subroutine for the transfer and use its existence to over-ride some of the constraints on derived types. If the transfer is recursive, require that the subroutine be so qualified. (dtio_procs_present): New function. (resolve_fl_namelist): Remove inhibition of polymorphic objects in namelists if DTIO read and write subroutines exist. Likewise for derived types. (resolve_types): Invoke 'gfc_verify_dtio_procedures'. * symbol.c : Set 'dtio_procs' using 'minit'. * trans-decl.c (gfc_finish_var_decl): If a derived-type/class object is associated with DTIO procedures, make it TREE_STATIC. * trans-expr.c (gfc_get_vptr_from_expr): If the expression drills down to a PARM_DECL, extract the vptr correctly. (gfc_conv_derived_to_class): Check 'info' in the test for 'useflags'. If the se expression exists and is a pointer, use it as the class _data. * trans-io.c : Add IOCALL_X_DERIVED to iocall and the function prototype. Likewise for IOCALL_SET_NML_DTIO_VAL. (set_parameter_tree): Renamed from 'set_parameter_const', now returns void and has new tree argument. Calls modified to match new interface. (transfer_namelist_element): Transfer DTIO procedure pointer and vpointer using the new function IOCALL_SET_NML_DTIO_VAL. (get_dtio_proc): New function. (transfer_expr): Add new argument for the vptr field of class objects. Add the code to call the specific DTIO proc, convert derived types to class and call IOCALL_X_DERIVED. (trans_transfer): Add BT_CLASS to structures for treatment by the scalarizer. Obtain the vptr for the dynamic type, both for scalar and array transfer. 2016-08-31 Jerry DeLisle <jvdelisle@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> PR libgfortran/48298 * gfortran.map : Flag _st_set_nml_dtio_var and _gfortran_transfer_derived. * io/format.c (format_lex): Detect DTIO formatting. (parse_format_list): Parse the DTIO format. (next_format): Include FMT_DT. * io/format.h : Likewise. Add structure 'udf' to structure 'fnode' to carry the IOTYPE string and the 'vlist'. * io/io.h : Add prototypes for the two types of DTIO subroutine and a typedef for gfc_class. Also, add to 'namelist_type' fields for the pointer to the DTIO procedure and the vtable. Add fields to struct st_parameter_dt for pointers to the two types of DTIO subroutine. Add to gfc_unit DTIO specific fields. (internal_proto): Add prototype for 'read_user_defined' and 'write_user_defined'. * io/list_read.c (check_buffers): Use the 'current_unit' field. (unget_char): Likewise. (eat_spaces): Likewise. (list_formatted_read_scalar): For case BT_CLASS, call the DTIO procedure. (nml_get_obj_data): Likewise when DTIO procedure is present,. * io/transfer.c : Export prototypes for 'transfer_derived' and 'transfer_derived_write'. (unformatted_read): For case BT_CLASS, call the DTIO procedure. (unformatted_write): Likewise. (formatted_transfer_scalar_read): Likewise. (formatted_transfer_scalar_write: Likewise. (transfer_derived): New function. (data_transfer_init): Set last_char if no child_dtio. (finalize_transfer): Return if child_dtio set. (st_write_done): Add condition for child_dtio not set. Add extra arguments for st_set_nml_var prototype. (set_nml_var): New function that contains the contents of the old version of st_set_nml_var. Also sets the 'dtio_sub' and 'vtable' fields of the 'nml' structure. (st_set_nml_var): Now just calls set_nml_var with 'dtio_sub' and 'vtable' NULL. (st_set_nml_dtio_var): New function that calls set_nml_var. * io/unit.c (get_external_unit): If the found unit child_dtio is non zero, don't do any mutex locking/unlocking. Just return the unit. * io/unix.c (tempfile_open): Revert to C style comment. * io/write.c (list_formatted_write_scalar): Do the DTIO call. (nml_write_obj): Add BT_CLASS and do the DTIO call. 2016-08-31 Jerry DeLisle <jvdelisle@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> PR fortran/48298 * gfortran.dg/dtio_1.f90: New test. * gfortran.dg/dtio_2.f90: New test. * gfortran.dg/dtio_3.f90: New test. * gfortran.dg/dtio_4.f90: New test. * gfortran.dg/dtio_5.f90: New test. * gfortran.dg/dtio_6.f90: New test. * gfortran.dg/dtio_7.f90: New test. * gfortran.dg/dtio_8.f90: New test. * gfortran.dg/dtio_9.f90: New test. * gfortran.dg/dtio_10.f90: New test. From-SVN: r239880
2016-08-29Fix, reorganize, and clarify comparisons of anonymous types/components.Fritz Reese1-25/+37
2016-08-29 Fritz Reese <fritzoreese@gmail.com> Fix, reorganize, and clarify comparisons of anonymous types/components. PR fortran/77327 * interface.c (is_anonymous_component, is_anonymous_dt): New functions. * interface.c (compare_components, gfc_compare_derived_types): Use new functions. * gfortran.dg/dec_structure_13.f90: New testcase. From-SVN: r239819
2016-08-23interface.c (compare_components): Fix typo in name check conditional.Fritz Reese1-1/+1
2016-08-23 Fritz Reese <fritzoreese@gmail.com> gcc/fortran/ * interface.c (compare_components): Fix typo in name check conditional. From-SVN: r239706
2016-08-22re PR fortran/61318 (Improve error diagnostic by pointing to the expression ↵Steven G. Kargl1-1/+1
and not to declared-at of a USE-associated variable) 2016-08-22 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/61318 * interface.c (compare_parameter): Use better locus for error message. 2016-08-22 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/61318 * gfortran.dg/pr61318.f90: New test. From-SVN: r239667
2016-05-15re PR fortran/69603 (ICE: segfault with -fimplicit-none and ↵Harald Anlauf1-1/+1
proc_ptr_comp_24.f90) 2016-05-15 Harald Anlauf <anlauf@gmx.de> PR fortran/69603 * interface.c (compare_parameter): Check for non-NULL pointer. 2016-05-15 Harald Anlauf <anlauf@gmx.de> PR fortran/69603 * gfortran.dg/pr69603.f90: New testcase. From-SVN: r236253
2016-05-07re PR fortran/56226 (Add support for DEC UNION and MAP extensions)Fritz Reese1-54/+161
2016-05-07 Fritz Reese <fritzoreese@gmail.com> PR fortran/56226 * module.c (dt_upper_string): Rename to gfc_dt_upper_string (dt_lower_string): Likewise. * gfortran.h: Make new gfc_dt_upper/lower_string global. * class.c: Use gfc_dt_upper_string. * decl.c: Likewise. * symbol.c: Likewise. * resolve.c (resolve_component): New function. (resolve_fl_derived0): Move component loop code to resolve_component. * parse.c (check_component): New function. (parse_derived): Move loop code to check_component. * lang.opt, invoke.texi, options.c : New option -fdec-structure. * libgfortran.h (bt): New basic type BT_UNION. * gfortran.h (gfc_option): New option -fdec-structure. (gfc_get_union_type, gfc_compare_union_types): New prototypes. (gfc_bt_struct, gfc_fl_struct, case_bt_struct, case_fl_struct): New macros. (gfc_find_component): Change prototype. * match.h (gfc_match_member_sep, gfc_match_map, gfc_match_union, gfc_match_structure_decl): New prototypes. * parse.h (gfc_comp_struct): New macro. * symbol.c (gfc_find_component): Search for components in nested unions * class.c (insert_component_ref, gfc_add_component_ref, add_proc_comp, copy_vtab_proc_comps): Update calls to gfc_find_component. * primary.c (gfc_convert_to_structure_constructor): Likewise. * symbol.c (gfc_add_component): Likewise. * resolve.c (resolve_typebound_function, resolve_typebound_subroutine, resolve_typebound_procedure, resolve_component, resolve_fl_derived): Likewise. * expr.c (get_union_init, component_init): New functions. * decl.c (match_clist_expr, match_record_decl, get_struct_decl, gfc_match_map, gfc_match_union, gfc_match_structure_decl): Likewise. * interface.c (compare_components, gfc_compare_union_types): Likewise. * match.c (gfc_match_member_sep): Likewise. * parse.c (check_component, parse_union, parse_struct_map): Likewise. * resolve.c (resolve_fl_struct): Likewise. * symbol.c (find_union_component): Likewise. * trans-types.c (gfc_get_union_type): Likewise. * parse.c (parse_derived): Use new functions. * interface.c (gfc_compare_derived_types, gfc_compare_types): Likewise. * expr.c (gfc_default_initializer): Likewise. * gfortran.texi: Support for DEC structures, unions, and maps. * gfortran.h (gfc_statement, sym_flavor): Likewise. * check.c (gfc_check_kill_sub): Likewise. * expr.c (gfc_copy_expr, simplify_const_ref, gfc_has_default_initializer): Likewise. * decl.c (build_sym, match_data_constant, add_init_expr_to_sym, match_pointer_init, build_struct, variable_decl, gfc_match_decl_type_spec, gfc_mach_data-decl, gfc_match_entry, gfc_match_end, gfc_match_derived_decl): Likewise. * interface.c (check_interface0, check_interface1, gfc_search_interface): Likewise. * misc.c (gfc_basic_typename, gfc_typename): Likewise. * module.c (add_true_name, build_tnt, bt_types, mio_typespec, fix_mio_expr, load_needed, mio_symbol, read_module, write_symbol, gfc_get_module_backend_decl): Likewise. * parse.h (gfc_compile_state): Likewise. * parse.c (decode_specification_statement, decode_statement, gfc_ascii_statement, verify_st_order, parse_spec): Likewise. * primary.c (gfc_match_varspec, gfc_match_structure_constructor, gfc_match_rvalue, match_variable): Likewise. * resolve.c (find_arglists, resolve_structure_cons, is_illegal_recursion, resolve_generic_f, get_declared_from_expr, resolve_typebound_subroutine, resolve_allocate_expr, nonscalar_typebound_assign, generate_component_assignments, resolve_fl_variable_derived, check_defined_assignments, resolve_component, resolve_symbol, resolve_equivalence_derived): Likewise. * symbol.c (flavors, check_conflict, gfc_add_flavor, gfc_use_derived, gfc_restore_last_undo_checkpoint, gfc_type_compatible, gfc_find_dt_in_generic): Likewise. * trans-decl.c (gfc_get_module_backend_decl, create_function_arglist, gfc_create_module_variable, check_constant_initializer): Likewise. * trans-expr.c (gfc_conv_component_ref, gfc_conv_initializer, gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign, gfc_conv_structure, gfc_trans_scalar_assign, copyable_array_p): Likewise. * trans-io.c (transfer_namelist_element, transfer_expr, gfc_trans_transfer): Likewise. * trans-stmt.c (gfc_trans_deallocate): Likewise. * trans-types.c (gfc_typenode_for_spec, gfc_copy_dt_decls_ifequal, gfc_get_derived_type): Likewise. 2016-05-07 Fritz Reese <fritzoreese@gmail.com> PR fortran/56226 * gfortran.dg/dec_structure_1.f90: New testcase. * gfortran.dg/dec_structure_2.f90: Ditto. * gfortran.dg/dec_structure_3.f90: Ditto. * gfortran.dg/dec_structure_4.f90: Ditto. * gfortran.dg/dec_structure_5.f90: Ditto. * gfortran.dg/dec_structure_6.f90: Ditto. * gfortran.dg/dec_structure_7.f90: Ditto. * gfortran.dg/dec_structure_8.f90: Ditto. * gfortran.dg/dec_structure_9.f90: Ditto. * gfortran.dg/dec_structure_10.f90: Ditto. * gfortran.dg/dec_structure_11.f90: Ditto. * gfortran.dg/dec_union_1.f90: Ditto. * gfortran.dg/dec_union_2.f90: Ditto. * gfortran.dg/dec_union_3.f90: Ditto. * gfortran.dg/dec_union_4.f90: Ditto. * gfortran.dg/dec_union_5.f90: Ditto. * gfortran.dg/dec_union_6.f90: Ditto. * gfortran.dg/dec_union_7.f90: Ditto. From-SVN: r235999
2016-01-24[multiple changes]Jerry DeLisle1-1/+2
2016-01-23 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/69397 PR fortran/68442 * interface.c (gfc_arglist_matches_symbol): Replace assert with a return false if not a procedure. * resolve.c (resolve_generic_f): Test if we are resolving an initialization expression and adjust error message accordingly. 2016-01-24 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/69397 PR fortran/68442 * gfortran.dg/interface_38.f90: New test. * gfortran.dg/interface_39.f90: New test. From-SVN: r232780