summaryrefslogtreecommitdiff
path: root/gcc/fortran/primary.c
Commit message (Collapse)AuthorAgeFilesLines
* 2017-09-21 Paul Thomas <pault@gcc.gnu.org>pault2017-09-211-19/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR fortran/52832 * match.c (gfc_match_associate): Before failing the association try again, allowing a proc pointer selector. PR fortran/80120 PR fortran/81903 PR fortran/82121 * primary.c (gfc_match_varspec): Introduce 'tgt_expr', which points to the associate selector, if any. Go through selector references, after resolution for variables, to catch any full or section array references. If a class associate name does not have the same declared type as the selector, resolve the selector and copy the declared type to the associate name. Before throwing a no implicit type error, resolve all allowed selector expressions, and copy the resulting typespec. PR fortran/67543 * resolve.c (resolve_assoc_var): Selector must cannot be the NULL expression and it must have a type. PR fortran/78152 * resolve.c (resolve_symbol): Allow associate names to be coarrays. 2017-09-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/78512 * gfortran.dg/associate_26.f90 : New test. PR fortran/80120 * gfortran.dg/associate_27.f90 : New test. PR fortran/81903 * gfortran.dg/associate_28.f90 : New test. PR fortran/82121 * gfortran.dg/associate_29.f90 : New test. PR fortran/67543 * gfortran.dg/associate_30.f90 : New test. PR fortran/52832 * gfortran.dg/associate_31.f90 : New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253077 138bc75d-0d04-0410-961f-82ee72b054a4
* 2017-09-17 Paul Thomas <pault@gcc.gnu.org>pault2017-09-171-2/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR fortran/82173 * decl.c (gfc_get_pdt_instance): Use the component initializer expression for the default, rather than the parameter value. * resolve.c (resolve_pdt): New function. (resolve_symbol): Call it. Remove false error, prohibiting deferred type parameters for dummy arguments. PR fortran/60483 * primary.c (gfc_match_varspec): If the type of an associate name is unknown and yet there is a match, try resolving the target expression and using its type. 2017-09-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/82173 * gfortran.dg/pdt_1.f03 : Eliminate spurious error checks. * gfortran.dg/pdt_2.f03 : The same. * gfortran.dg/pdt_3.f03 : The same. * gfortran.dg/pdt_4.f03 : Add 'modtype' and two new errors in module 'bad_vars'. Add error concerning assumed parameters and save attribute. * gfortran.dg/pdt_11.f03 : New test. PR fortran/60483 * gfortran.dg/associate_9.f90 : Remove XFAIL and change to run. * gfortran.dg/associate_25.f90 : New test. * gfortran.dg/pdt_12.f03 : New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252894 138bc75d-0d04-0410-961f-82ee72b054a4
* 2017-09-12 Paul Thomas <pault@gcc.gnu.org>pault2017-09-121-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR fortran/82173 PR fortran/82168 * decl.c (variable_decl): Check pdt template components for appearance of KIND/LEN components in the type parameter name list, that components corresponding to type parameters have either KIND or LEN attributes and that KIND or LEN components are scalar. Copy the initializer to the parameter value. (gfc_get_pdt_instance): Add a label 'error_return' and follow it with repeated code, while replacing this code with a jump. Check if a parameter appears as a component in the template. Make sure that the parameter expressions are integer. Validate KIND expressions. (gfc_match_decl_type_spec): Search for pdt_types in the parent namespace since they are instantiated in the template ns. * expr.c (gfc_extract_int): Use a KIND parameter if it appears as a component expression. (gfc_check_init_expr): Allow expressions with the pdt_kind attribute. *primary.c (gfc_match_actual_arglist): Make sure that the first keyword argument is recognised when 'pdt' is set. 2017-09-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/82173 * gfortran.dg/pdt_4.f03 : Remove the 'is being used before it is defined' error. * gfortran.dg/pdt_6.f03 : New test. * gfortran.dg/pdt_7.f03 : New test. * gfortran.dg/pdt_8.f03 : New test. PR fortran/82168 * gfortran.dg/pdt_9.f03 : New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@252039 138bc75d-0d04-0410-961f-82ee72b054a4
* 2017-09-09 Paul Thomas <pault@gcc.gnu.org>pault2017-09-091-10/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@251925 138bc75d-0d04-0410-961f-82ee72b054a4
* fortran: remove trailing exclamation mark from various diagnostics (PR ↵dmalcolm2017-05-191-6/+6
| | | | | | | | | | | | | | | | | fortran/79852) gcc/fortran/ChangeLog: PR fortran/79852 * bbt.c (insert): Remove trailing exclamation mark from message. * decl.c (gfc_match_final_decl): Likewise. * dump-parse-tree.c (show_expr): Likewise. * module.c (gfc_use_module): Likewise. * primary.c (build_actual_constructor): Likewise. (gfc_convert_to_structure_constructor): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@248283 138bc75d-0d04-0410-961f-82ee72b054a4
* 2017-03-22 Dominique d'Humieres <dominiq@lps.ens.fr>dominiq2017-03-221-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246391 138bc75d-0d04-0410-961f-82ee72b054a4
* * gfortran.h (gfc_extract_int): Change return type to bool. Addjakub2017-01-211-18/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | int argument with = 0. * decl.c (gfc_match_kind_spec): Adjust gfc_extract_int caller, pass 1 as new last argument to it, don't emit gfc_error. (match_char_kind): Likewise. (gfc_match_decl_type_spec): Use gfc_get_string ("%s", x) instead of gfc_get_string (x). (gfc_match_derived_decl, match_binding_attributes): Likewise. (gfc_match_structure_decl): Don't sprintf back to name, call get_struct_decl directly with gfc_dt_upper_string (name) result. * trans-stmt.c (gfc_trans_allocate): Use gfc_get_string ("%s", x) instead of gfc_get_string (x). * module.c (gfc_dt_lower_string, gfc_dt_upper_string, gfc_match_use, gfc_match_submodule, find_true_name, mio_pool_string, mio_symtree_ref, mio_expr, mio_omp_udr_expr, load_generic_interfaces, load_omp_udrs, load_needed, read_module, dump_module, create_intrinsic_function, import_iso_c_binding_module, create_int_parameter, create_int_parameter_array, create_derived_type, use_iso_fortran_env_module): Likewise. * error.c (gfc_diagnostic_starter, gfc_diagnostic_start_span): Use pp_verbatim (context->printer, "%s", x) instead of pp_verbatim (context->printer, x). * match.c (gfc_match_small_int): Adjust gfc_extract_int caller, pass 1 as new last argument to it, don't emit gfc_error. (gfc_match_small_int_expr): Likewise. * iresolve.c (gfc_get_string): Optimize format "%s" case. (resolve_bound): Use gfc_get_string ("%s", x) instead of gfc_get_string (x). (resolve_transformational): Formatting fix. (gfc_resolve_char_achar): Change name argument to bool is_achar, use a single format string and if is_achar add "a" before "char". (gfc_resolve_achar, gfc_resolve_char): Adjust callers. * expr.c (gfc_extract_int): Change return type to bool, return true if some error occurred. Add REPORT_ERROR argument, if non-zero call either gfc_error or gfc_error_now depending on its sign. * arith.c (arith_power): Adjust gfc_extract_int caller. * symbol.c (gfc_add_component): Use gfc_get_string ("%s", x) instead of gfc_get_string (x). (gfc_new_symtree, gfc_delete_symtree, gfc_get_uop, gfc_new_symbol, gfc_get_gsymbol, generate_isocbinding_symbol): Likewise. * openmp.c (gfc_match_omp_clauses): Adjust gfc_extract_int caller, pass -1 as new last argument to it, don't emit gfc_error_now. (gfc_match_omp_declare_reduction): Use gfc_get_string ("%s", x) instead of gfc_get_string (x). * check.c (kind_check): Adjust gfc_extract_int caller. * intrinsic.c (add_sym, find_sym, make_alias): Use gfc_get_string ("%s", x) instead of gfc_get_string (x). * simplify.c (get_kind, gfc_simplify_btest, gfc_simplify_maskr, gfc_simplify_maskl, gfc_simplify_poppar, gfc_simplify_repeat, gfc_simplify_selected_int_kind, gfc_simplify_selected_real_kind): Adjust gfc_extract_int callers. * trans-decl.c (gfc_find_module): Use gfc_get_string ("%s", x) instead of gfc_get_string (x). * matchexp.c (expression_syntax): Add const. * primary.c (match_kind_param, match_hollerith_constant, match_string_constant): Adjust gfc_extract_int callers. (match_keyword_arg): Use gfc_get_string ("%s", x) instead of gfc_get_string (x). * frontend-passes.c (optimize_minmaxloc): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244744 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc/testsuite/ChangeLog:vehre2017-01-181-3/+5
| | | | | | | | | | | | | | | | | | | | | 2017-01-18 Andre Vehreschild <vehre@gcc.gnu.org> * gfortran.dg/coarray_alloc_with_implicit_sync_2.f90: New test. Also fixed date in gcc/testsuite/ChangeLog on my previous commit. gcc/fortran/ChangeLog: 2017-01-18 Andre Vehreschild <vehre@gcc.gnu.org> * primary.c (caf_variable_attr): Improve figuring whether the current component is the last one refed. * trans-stmt.c (gfc_trans_allocate): Do not generate sync_all calls when allocating pointer or allocatable components. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244590 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc/fortran/ChangeLog:vehre2017-01-071-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/78781 PR fortran/78935 * expr.c (gfc_check_pointer_assign): Return the same error message for rewritten coarray pointer assignments like for plain ones. * gfortran.h: Change prototype. * primary.c (caf_variable_attr): Set attributes used ones only only ones. Add setting of pointer_comp attribute. (gfc_caf_attr): Add setting of pointer_comp attribute. * trans-array.c (gfc_array_allocate): Add flag that the component to allocate is not an ultimate coarray component. Add allocation of pointer arrays. (structure_alloc_comps): Extend nullify to treat pointer components in coarrays correctly. Restructure nullify to remove redundant code. (gfc_nullify_alloc_comp): Allow setting caf_mode flags. * trans-array.h: Change prototype of gfc_nullify_alloc_comp (). * trans-decl.c (generate_coarray_sym_init): Call nullify_alloc_comp for derived type coarrays with pointer components. * trans-expr.c (gfc_trans_structure_assign): Also treat pointer components. (trans_caf_token_assign): Handle assignment of token of scalar pointer components. (gfc_trans_pointer_assignment): Call above routine. * trans-intrinsic.c (conv_expr_ref_to_caf_ref): Add treating pointer components. (gfc_conv_intrinsic_caf_get): Likewise. (conv_caf_send): Likewise. * trans-stmt.c (gfc_trans_allocate): After allocating a derived type in a coarray pre-register the tokens. (gfc_trans_deallocate): Simply determining the coarray type (scalar or array) and deregistering it correctly. * trans-types.c (gfc_typenode_for_spec): Replace in_coarray flag by the actual codim to allow lookup of array types in the cache. (gfc_build_array_type): Likewise. (gfc_get_array_descriptor_base): Likewise. (gfc_get_array_type_bounds): Likewise. (gfc_get_derived_type): Likewise. * trans-types.h: Likewise. * trans.c (gfc_deallocate_with_status): Enable deregistering of all kind of coarray components. (gfc_deallocate_scalar_with_status): Use free() in fcoarray_single mode instead of caf_deregister. libgfortran/ChangeLog: 2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/78781 PR fortran/78935 * caf/single.c (send_by_ref): Fix addressing of non-allocatable scalar destination components. gcc/testsuite/ChangeLog: 2017-01-07 Andre Vehreschild <vehre@gcc.gnu.org> * gfortran.dg/coarray/ptr_comp_1.f08: New test. * gfortran.dg/coarray/ptr_comp_2.f08: New test. * gfortran.dg/coarray/ptr_comp_3.f08: New test. * gfortran.dg/coarray/ptr_comp_4.f08: New test. * gfortran.dg/coarray_ptr_comp_1.f08: New test. * gfortran.dg/coarray_ptr_comp_2.f08: New test. * gfortran.dg/coarray_ptr_comp_3.f08: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244196 138bc75d-0d04-0410-961f-82ee72b054a4
* Update copyright years.jakub2017-01-011-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243994 138bc75d-0d04-0410-961f-82ee72b054a4
* 2016-12-03 Janus Weil <janus@gcc.gnu.org>janus2016-12-031-1/+9
| | | | | | | | | | | | | | PR fortran/43207 * primary.c (gfc_match_varspec): Reject nonpolymorphic references to abstract types. 2016-12-03 Janus Weil <janus@gcc.gnu.org> PR fortran/43207 * gfortran.dg/abstract_type_9.f90: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243224 138bc75d-0d04-0410-961f-82ee72b054a4
* 2016-12-03 Janus Weil <janus@gcc.gnu.org>janus2016-12-031-0/+9
| | | | | | | | | | | | | | PR fortran/42188 * primary.c (gfc_match_rvalue): Add a new check that gives better error messages. 2016-12-03 Janus Weil <janus@gcc.gnu.org> PR fortran/42188 * gfortran.dg/derived_result_2.f90.f90: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243223 138bc75d-0d04-0410-961f-82ee72b054a4
* libgfortran/ChangeLog:vehre2016-11-301-10/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2016-11-30 Andre Vehreschild <vehre@gcc.gnu.org> * caf/libcaf.h: Add new action types for (de-)registration of allocatable components in derived type coarrays. Add _caf_is_present prototype. * caf/single.c (_gfortran_caf_register): Add support for registration only and allocation of already registered allocatable components in derived type coarrays. (_gfortran_caf_deregister): Add mode to deallocate but not deregister an allocatable component in a derived type coarray. (_gfortran_caf_is_present): New function. Query whether an allocatable component in a derived type coarray on a remote image is allocated. gcc/testsuite/ChangeLog: 2016-11-30 Andre Vehreschild <vehre@gcc.gnu.org> * gfortran.dg/coarray/alloc_comp_1.f90: Fix tree-dump scans to adhere to the changed interfaces. * gfortran.dg/coarray_alloc_comp_1.f08: Likewise. * gfortran.dg/coarray_allocate_7.f08: Likewise. * gfortran.dg/coarray_lib_alloc_1.f90: Likewise. * gfortran.dg/coarray_lib_alloc_2.f90: Likewise. * gfortran.dg/coarray_lib_alloc_3.f90: Likewise. * gfortran.dg/coarray_lib_comm_1.f90: Likewise. * gfortran.dg/coarray_lib_alloc_4.f90: New test. gcc/fortran/ChangeLog: 2016-11-30 Andre Vehreschild <vehre@gcc.gnu.org> * check.c (gfc_check_allocated): By pass the caf_get call and check on the array. * gfortran.h: Add optional flag to gfc_caf_attr. * gfortran.texi: Document new enum values and _caf_is_present function. * primary.c (caf_variable_attr): Add optional flag to indicate that the expression is reffing a component. (gfc_caf_attr): Likewise. * trans-array.c (gfc_array_deallocate): Handle deallocation mode for coarray deregistration. (gfc_trans_dealloc_allocated): Likewise. (duplicate_allocatable): Use constants instead of creating custom constant tree node of zero or one. Use gfc_add_modify convenience function. (duplicate_allocatable_coarray): This function is similar to duplicate_allocatable but tailored to handle coarrays. (caf_enabled): Check whether in-derived-type coarray processing is enabled. (caf_in_coarray): Check that in-derived-type coarray processing is enabled and currently in a derived-typed coarray. (gfc_caf_is_dealloc_only): Return true, when deallocate only is desired for components in derived typed coarrays. (structure_alloc_comps): A mode for handling coarrays, that is no longer encode in the purpose. This makes the use cases of the routine more flexible without repeating. Allocatable components in derived type coarrays are now registered only when nullifying an object and allocated before copying data into them. (gfc_nullify_alloc_comp): Use the caf_mode of structure_alloc_comps now. (gfc_deallocate_alloc_comp): Likewise. (gfc_deallocate_alloc_comp_no_caf): Likewise. (gfc_reassign_alloc_comp_caf): Likewise. (gfc_copy_alloc_comp): Likewise. (gfc_copy_only_alloc_comp): Likewise. (gfc_alloc_allocatable_for_assignment): Make use to the cheaper way of reallocating a coarray without deregistering and reregistering it. (gfc_trans_deferred_array): Initialize the coarray token correctly for deferred variables and tear them down on exit. * trans-array.h: Change some prototypes to add the coarray (de-) registration modes. Add prototype for checking if deallocate only is selected for components in derived typed coarrays. * trans-decl.c (gfc_build_builtin_function_decls): Generate the declarations for the changed/new caf-lib routines. (gfc_trans_deferred_vars): Ensure deferred variables are (de-) registered correctly on procedure entry/exit. (generate_coarray_sym_init): Use constants. * trans-expr.c (gfc_conv_procedure_call): Propagate coarray allocation modes accordingly. (gfc_trans_alloc_subarray_assign): Likewise. (gfc_trans_subcomponent_assign): Likewise. (gfc_trans_structure_assign): Generate code to register the components of a derived type coarray prior to initialization. (gfc_conv_structure): Set flag that the structure is in a coarray. (gfc_trans_scalar_assign): Add flag to indicate being in a coarray and set the structure_alloc_comps modes correctly. (gfc_trans_assignment_1): Figure being in a coarray expression. * trans-intrinsic.c (gfc_conv_intrinsic_caf_get): Adapt to new structure_alloc_comps interface. (conv_caf_send): Use the old API as long as possible. (trans_caf_is_present): Generate code to check whether an allocatable component in a derived typed coarray is allocated on a remote image. (caf_this_image_ref): Return true, when only reffing this image. (gfc_conv_allocated): Convert allocated queries on allocatable components to the library API. (conv_intrinsic_move_alloc): Adapt to new interface of structure_alloc_comps. * trans-openmp.c (gfc_walk_alloc_comps): Likewise. (gfc_omp_clause_assign_op): Likewise. (gfc_omp_clause_dtor): Likewise. * trans-stmt.c (gfc_trans_deallocate): Figure which mode to use when deallocating allocatable components in derived type coarras. * trans.c (gfc_allocate_using_lib): Renamed to gfc_allcate_using_caf_lib. (gfc_allocate_allocatable): Set the registration mode/type of caf- register calls adapting to all the possible allocatable objects. (gfc_deallocate_with_status): Add deregistration mode for allocatable components in derived type coarrays. (gfc_deallocate_scalar_with_status): Likewise. * trans.h (enum gfc_coarray_type): Renamed to gfc_coarray_regtype to avoid collision with gfc_coarray_deregtype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243021 138bc75d-0d04-0410-961f-82ee72b054a4
* 2016-11-30 Janus Weil <janus@gcc.gnu.org>janus2016-11-301-1/+1
| | | | | | | | | | | | | PR fortran/78593 * primary.c (gfc_match_varspec): Check if sym is non-null to avoid ICE. 2016-11-30 Janus Weil <janus@gcc.gnu.org> PR fortran/78593 * gfortran.dg/derived_result.f90: New test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@243020 138bc75d-0d04-0410-961f-82ee72b054a4
* 2016-04-19 Paul Thomas <pault@gcc.gnu.org>pault2016-11-041-7/+28
| | | | | | | | | | | | | | | | PR fortran/64933 * primary.c (gfc_match_varspec): If selector expression is unambiguously an array, make sure that the associate name is an array and has an array spec. Modify the original condition for doing this to exclude character types. 2016-04-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/64933 * gfortran.dg/associate_23.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241860 138bc75d-0d04-0410-961f-82ee72b054a4
* Default missing exponents to 0 with -fdec.foreese2016-11-031-5/+14
| | | | | | | | | | | | | | | | | | | | | | | gcc/fortran/ * gfortran.texi: Document. * gfortran.h (gfc_dt): New field default_exp. * primary.c (match_real_constant): Default exponent with -fdec. * io.c (match_io): Set dt.default_exp with -fdec. * ioparm.def (IOPARM_dt_default_exp): New. * trans-io.c (build_dt): Set IOPARM_dt_default_exp with -fdec. libgfortran/io/ * io.h (IOPARM_DT_DEFAULT_EXP): New flag bit. * list_read.c (parse_real, read_real): Allow omission of exponent with IOPARM_DT_DEFAULT_EXP. * read.c (read_f): Ditto. gcc/testsuite/gfortran.dg/ * dec_exp_1.f90, dec_exp_2.f90, dec_exp_3.f90: New testcases. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241828 138bc75d-0d04-0410-961f-82ee72b054a4
* 2016-10-30 Thomas Koenig <tkoenig@gcc.gnu.org>tkoenig2016-10-301-0/+4
| | | | | | | | | | | | | | | | | | PR fortran/67219 * arith.c (gfc_int2real): Change gfc_warning_now to gfc_warning. * primary.c (match_complex_constant): If there is no comma, throw away any warning which might have been issued by gfc_int2real. 2016-10-30 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/67219 * gfortran.dg/pr67219.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241689 138bc75d-0d04-0410-961f-82ee72b054a4
* Enable %LOC as an rvalue with -std=legacy.foreese2016-10-251-3/+14
| | | | | | | | | | | | | | | gcc/fortran/ * primary.c (gfc_match_rvalue): Match %LOC as LOC with -std=legacy. * gfortran.texi: Document. gcc/testsuite/gfortran.dg/ * dec_loc_rval_1.f90: New test. * dec_loc_rval_2.f90: New test. * dec_loc_rval_3.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241519 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc/fortran/ChangeLog:vehre2016-10-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2016-10-22 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/43366 PR fortran/51864 PR fortran/57117 PR fortran/61337 PR fortran/61376 * primary.c (gfc_expr_attr): For transformational functions on classes get the attrs from the class argument. * resolve.c (resolve_ordinary_assign): Remove error message due to feature implementation. Rewrite POINTER_ASSIGNS to ordinary ones when the right-hand side is scalar class object (with some restrictions). * trans-array.c (trans_array_constructor): Create the temporary from class' inner type, i.e., the derived type. (build_class_array_ref): Add support for class array's storage of the class object or the array descriptor in the decl saved descriptor. (gfc_conv_expr_descriptor): When creating temporaries for class objects add the class object's handle into the decl saved descriptor. (structure_alloc_comps): Use the common way to get the _data component. (gfc_is_reallocatable_lhs): Add notion of allocatable class objects. * trans-expr.c (gfc_find_and_cut_at_last_class_ref): Remove the only ref only when the expression's type is BT_CLASS. (gfc_trans_class_init_assign): Correctly handle class arrays. (gfc_trans_class_assign): Joined into gfc_trans_assignment_1. (gfc_conv_procedure_call): Support for class types as arguments. (trans_get_upoly_len): For unlimited polymorphics retrieve the _len component's tree. (trans_class_vptr_len_assignment): Catch all ways to assign the _vptr and _len components of a class object correctly. (pointer_assignment_is_proc_pointer): Identify assignments of procedure pointers. (gfc_trans_pointer_assignment): Enhance support for class object pointer assignments. (gfc_trans_scalar_assign): Removed assert. (trans_class_assignment): Assign to a class object. (gfc_trans_assignment_1): Treat class objects correctly. (gfc_trans_assignment): Propagate flags to trans_assignment_1. * trans-stmt.c (gfc_trans_allocate): Use gfc_trans_assignment now instead of copy_class_to_class. * trans-stmt.h: Function prototype removed. * trans.c (trans_code): Less special casing for class objects. * trans.h: Added flags to gfc_trans_assignment () prototype. gcc/testsuite/ChangeLog: 2016-10-22 Andre Vehreschild <vehre@gcc.gnu.org> Forgot to add on original commit. * gfortran.dg/coarray_alloc_comp_2.f08: New test. 2016-10-22 Andre Vehreschild <vehre@gcc.gnu.org> PR fortran/43366 PR fortran/57117 PR fortran/61337 * gfortran.dg/alloc_comp_class_5.f03: New test. * gfortran.dg/class_allocate_21.f90: New test. * gfortran.dg/class_allocate_22.f90: New test. * gfortran.dg/realloc_on_assign_27.f08: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@241439 138bc75d-0d04-0410-961f-82ee72b054a4
* Implement -Wimplicit-fallthrough.mpolacek2016-09-261-0/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240485 138bc75d-0d04-0410-961f-82ee72b054a4
* libgfortran/ChangeLog:vehre2016-09-191-0/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2016-09-19 Andre Vehreschild <vehre@gcc.gnu.org> * caf/libcaf.h: Add caf_reference_type. * caf/mpi.c: Adapted signature of caf_register(). * caf/single.c (struct caf_single_token): Added to keep the pointer to the memory registered and array descriptor. (caf_internal_error): Added convenience interface. (_gfortran_caf_register): Adapted to work with caf_single_token and return memory in the array descriptor. (_gfortran_caf_deregister): Same. (assign_char1_from_char4): Fixed style. (convert_type): Fixed incorrect conversion. (_gfortran_caf_get): Adapted to work with caf_single_token. (_gfortran_caf_send): Same. (_gfortran_caf_sendget): Same. (copy_data): Added to stop repeating it in all _by_ref functions. (get_for_ref): Recursive getting of coarray data using a chain of references. (_gfortran_caf_get_by_ref): Driver for computing the memory needed for the get and checking properties of the operation. (send_by_ref): Same as get_for_ref but for sending data. (_gfortran_caf_send_by_ref): Same like caf_get_by_ref but for sending. (_gfortran_caf_sendget_by_ref): Uses get_by_ref and send_by_ref to implement sendget for reference chains. (_gfortran_caf_atomic_define): Adapted to work with caf_single_token. (_gfortran_caf_atomic_ref): Likewise. (_gfortran_caf_atomic_cas): Likewise. (_gfortran_caf_atomic_op): Likewise. (_gfortran_caf_event_post): Likewise. (_gfortran_caf_event_wait): Likewise. (_gfortran_caf_event_query): Likewise. (_gfortran_caf_lock): Likewise. (_gfortran_caf_unlock): Likewise. gcc/testsuite/ChangeLog: 2016-09-19 Andre Vehreschild <vehre@gcc.gnu.org> * gfortran.dg/coarray/alloc_comp_4.f90: New test. * gfortran.dg/coarray_38.f90: * gfortran.dg/coarray_alloc_comp_1.f08: New test. * gfortran.dg/coarray_alloc_comp_2.f08: New test. * gfortran.dg/coarray_allocate_7.f08: New test. * gfortran.dg/coarray_allocate_8.f08: New test. * gfortran.dg/coarray_allocate_9.f08: New test. * gfortran.dg/coarray_lib_alloc_1.f90: Adapted scan-tree-dumps to expect new caf_register. * gfortran.dg/coarray_lib_alloc_2.f90: Same. * gfortran.dg/coarray_lib_alloc_3.f90: Same. * gfortran.dg/coarray_lib_comm_1.f90: Adapted scan-tree-dumps to expect get_by_refs. * gfortran.dg/coarray_lib_token_3.f90: Same as for coarray_lib_alloc2. * gfortran.dg/coarray_lock_7.f90: Same. * gfortran.dg/coarray_poly_5.f90: Same. * gfortran.dg/coarray_poly_6.f90: Same. * gfortran.dg/coarray_poly_7.f90: Same. * gfortran.dg/coarray_poly_8.f90: Same. * gfortran.dg/coindexed_1.f90: Changed errors expected. gcc/fortran/ChangeLog: 2016-09-19 Andre Vehreschild <vehre@gcc.gnu.org> * expr.c (gfc_check_assign): Added flag to control whether datatype conversion is allowed. * gfortran.h: Added caf-token-tree to gfc_component. Changed prototypes mostly to add whether datatype conversion is allowed. * gfortran.texi: Added documentation for the caf_reference_t and the caf_*_by_ref function. * primary.c (caf_variable_attr): Similar to gfc_variable_attr but focused on the needs of coarrays. (gfc_caf_attr): Same. * resolve.c (resolve_ordinary_assign): Set the conversion allowed flag when not in a coarray. * trans-array.c (gfc_array_init_size): Moved setting of array descriptor's datatype before the alloc, because caf_register needs it. (gfc_array_allocate): Changed notion of whether an array is a coarray. (gfc_array_deallocate): Same. (gfc_alloc_allocatable_for_assignment): Added setting of coarray's array descriptor datatype before the register. And using deregister/ register to mimmick a realloc for coarrays. * trans-decl.c (gfc_build_builtin_function_decls): Corrected signatures of old caf-functions and added signature definitions of the _by_ref ones. (generate_coarray_sym_init): Adapted to new caf_register signature. * trans-expr.c (gfc_conv_scalar_to_descriptor): Make sure a constant is translated to an lvalue expression before use in an array descriptor. (gfc_get_ultimate_alloc_ptr_comps_caf_token): New function. Get the last allocatable component's coarray token. (gfc_get_tree_for_caf_expr): For top-level object get the coarray token and check for unsupported features. (gfc_get_caf_token_offset): Getting the offset might procude new statements, which now are stored in the pre and post of the current se. (gfc_caf_get_image_index): For this image return a call to caf_this_image. (expr_may_alias_variables): Check that the result is set for testing its properties. (alloc_scalar_allocatable_for_assignment): Added auto allocation of coarray components. (gfc_trans_assignment_1): Rewrite an assign to a coarray object to be a sendget. * trans-intrinsic.c (conv_caf_vector_subscript_elem): Corrected wrong comment. (compute_component_offset): Compute the correct offset a structure member. (conv_expr_ref_to_caf_ref): Convert to a chain of refs into caf_references. (gfc_conv_intrinsic_caf_get): Call caf_get_by_ref instead of caf_get. (conv_caf_send): Call caf_*_by_ref for coarrays that need reallocation. (gfc_conv_intrinsic_function): Adapted to new signuature of the caf drivers. (conv_intrinsic_atomic_op): Add pre and post statements correctly. (conv_intrinsic_atomic_ref): Same. (conv_intrinsic_atomic_cas): Same. (conv_intrinsic_event_query): Same. * trans-stmt.c (gfc_trans_lock_unlock): Same. (gfc_trans_event_post_wait): Same. (gfc_trans_allocate): Support allocation of allocatable coarrays. (gfc_trans_deallocate): And there deallocation. * trans-types.c (gfc_typenode_for_spec): Added flag to control whether a component is part of coarray. When so, then add space to store a coarray token. (gfc_build_array_type): Same. (gfc_get_array_descriptor_base): Same. (gfc_get_array_type_bounds): Same. (gfc_sym_type): Same. (gfc_get_derived_type): Same. (gfc_get_caf_reference_type): Declare the caf_reference_type. * trans-types.h: Prototype changes only. * trans.c (gfc_allocate_using_lib): Use the updated caf_register signature. (gfc_allocate_allocatable): Same. (gfc_deallocate_with_status): Same. * trans.h: Defined the runtime types for caf_reference_t and the enums. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240231 138bc75d-0d04-0410-961f-82ee72b054a4
* PR c/7652mpolacek2016-08-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc/ * alias.c (find_base_value): Adjust fall through comment. * cfgexpand.c (expand_debug_expr): Likewise. * combine.c (find_split_point): Likewise. (expand_compound_operation): Likewise. Add FALLTHRU. (make_compound_operation): Adjust fall through comment. (canon_reg_for_combine): Add FALLTHRU. (force_to_mode): Adjust fall through comment. (simplify_shift_const_1): Likewise. (simplify_comparison): Likewise. * config/aarch64/aarch64-builtins.c (aarch64_simd_expand_args): Add FALLTHRU. * config/aarch64/predicates.md: Likewise. * config/i386/i386.c (function_arg_advance_32): Likewise. (ix86_gimplify_va_arg): Likewise. (print_reg): Likewise. (ix86_print_operand): Likewise. (ix86_build_const_vector): Likewise. (ix86_expand_branch): Likewise. (ix86_sched_init_global): Adjust fall through comment. (ix86_expand_args_builtin): Add FALLTHRU. (ix86_expand_builtin): Likewise. (ix86_expand_vector_init_one_var): Likewise. * config/rs6000/rs6000.c (rs6000_emit_vector_compare_inner): Likewise. (rs6000_adjust_cost): Likewise. (insn_must_be_first_in_group): Likewise. * config/rs6000/rs6000.md: Likewise. Adjust fall through comment. * dbxout.c (dbxout_symbol): Adjust fall through comment. * df-scan.c (df_uses_record): Likewise. * dojump.c (do_jump): Add FALLTHRU. * dwarf2out.c (mem_loc_descriptor): Likewise. Adjust fall through comment. (resolve_args_picking_1): Adjust fall through comment. (loc_list_from_tree_1): Likewise. * expmed.c (make_tree): Likewise. * expr.c (expand_expr_real_2): Add FALLTHRU. (expand_expr_real_1): Likewise. Adjust fall through comment. * fold-const.c (const_binop): Adjust fall through comment. (fold_truth_not_expr): Likewise. (fold_cond_expr_with_comparison): Add FALLTHRU. (fold_binary_loc): Likewise. (contains_label_1): Adjust fall through comment. (multiple_of_p): Likewise. * gcov-tool.c (process_args): Add FALLTHRU. * genattrtab.c (check_attr_test): Likewise. (write_test_expr): Likewise. * genconfig.c (walk_insn_part): Likewise. * genpreds.c (validate_exp): Adjust fall through comment. (needs_variable): Likewise. * gensupport.c (get_alternatives_number): Add FALLTHRU. (subst_dup): Likewise. * gimple-pretty-print.c (dump_gimple_assign): Likewise. * gimplify.c (gimplify_addr_expr): Adjust fall through comment. (gimplify_scan_omp_clauses): Add FALLTHRU. (goa_stabilize_expr): Likewise. * graphite-isl-ast-to-gimple.c (substitute_ssa_name): Adjust fall through comment. * hsa-gen.c (get_address_from_value): Likewise. * ipa-icf.c (sem_function::hash_stmt): Likewise. * ira.c (ira_setup_alts): Add FALLTHRU. * lra-eliminations.c (lra_eliminate_regs_1): Adjust fall through comment. * lto-streamer-out.c (lto_output_tree_ref): Add FALLTHRU. * opts.c (common_handle_option): Likewise. * read-rtl.c (read_rtx_code): Likewise. * real.c (round_for_format): Likewise. * recog.c (asm_operand_ok): Likewise. * reginfo.c (reg_scan_mark_refs): Adjust fall through comment. * reload1.c (set_label_offsets): Likewise. (eliminate_regs_1): Likewise. (reload_reg_reaches_end_p): Likewise. * rtlanal.c (commutative_operand_precedence): Add FALLTHRU. (rtx_cost): Likewise. * sched-rgn.c (is_exception_free): Likewise. * simplify-rtx.c (simplify_rtx): Adjust fall through comment. * stor-layout.c (int_mode_for_mode): Likewise. * toplev.c (print_to_asm_out_file): Likewise. (print_to_stderr): Likewise. * tree-cfg.c (gimple_verify_flow_info): Likewise. * tree-chrec.c (chrec_fold_plus_1): Add FALLTHRU. (chrec_fold_multiply): Likewise. (evolution_function_is_invariant_rec_p): Likewise. (for_each_scev_op): Likewise. * tree-data-ref.c (siv_subscript_p): Likewise. (get_references_in_stmt): Likewise. * tree.c (find_placeholder_in_expr): Adjust fall through comment. (substitute_in_expr): Likewise. (type_cache_hasher::equal): Likewise. (walk_type_fields): Likewise. * var-tracking.c (adjust_mems): Add FALLTHRU. (set_dv_changed): Adjust fall through comment. * varasm.c (default_function_section): Add FALLTHRU. gcc/c-family/ * c-common.c (scalar_to_vector): Adjust fall through comment. * c-opts.c (c_common_handle_option): Likewise. * c-pragma.c (handle_pragma_pack): Add FALLTHRU. * c-pretty-print.c (c_pretty_printer::postfix_expression): Adjust fall through comment. * cilk.c (extract_free_variables): Add FALLTHRU. gcc/c/ * c-parser.c (c_parser_external_declaration): Add FALLTHRU. (c_parser_postfix_expression): Likewise. * c-typeck.c (build_unary_op): Adjust fall through comment. (c_mark_addressable): Likewise. gcc/cp/ * call.c (add_builtin_candidate): Add FALLTHRU. (build_integral_nontype_arg_conv): Adjust fall through comment. (build_new_op_1): Add FALLTHRU. (convert_like_real): Adjust fall through comment. * class.c (fixed_type_or_null): Likewise. * constexpr.c (cxx_eval_constant_expression): Likewise. (potential_constant_expression_1): Likewise. Add FALLTHRU. * cp-gimplify.c (cp_gimplify_expr): Adjust fall through comment. (cp_fold): Add FALLTHRU. * cvt.c (build_expr_type_conversion): Adjust fall through comment. * cxx-pretty-print.c (pp_cxx_unqualified_id): Add FALLTHRU. (pp_cxx_qualified_id): Likewise. (cxx_pretty_printer::constant): Adjust fall through comment. (cxx_pretty_printer::primary_expression): Add FALLTHRU. (pp_cxx_pm_expression): Adjust fall through comment. (cxx_pretty_printer::expression): Add FALLTHRU. (cxx_pretty_printer::declaration_specifiers): Reformat code. (pp_cxx_type_specifier_seq): Adjust fall through comment. (pp_cxx_ptr_operator): Likewise. Add FALLTHRU. * error.c (dump_type): Adjust fall through comment. (dump_decl): Likewise. * mangle.c (write_type): Likewise. * method.c (synthesized_method_walk): Add FALLTHRU. * name-lookup.c (arg_assoc_type): Likewise. * parser.c (cp_lexer_print_token): Adjust fall through comment. (cp_parser_primary_expression): Add FALLTHRU. (cp_parser_operator): Likewise. * pt.c (find_parameter_packs_r): Likewise. (tsubst_aggr_type): Adjust fall through comment. * semantics.c (finish_omp_clauses): Add FALLTHRU. * tree.c (lvalue_kind): Likewise. gcc/fortran/ * decl.c (match_attr_spec): Add FALLTHRU. * primary.c (match_arg_list_function): Likewise. * resolve.c (resolve_operator): Adjust fall through comment. (fixup_charlen): Add FALLTHRU. (resolve_allocate_expr): Adjust fall through comment. * trans-array.c (gfc_conv_ss_startstride): Add FALLTHRU. * trans-intrinsic.c (gfc_conv_intrinsic_len): Adjust fall through comment. gcc/java/ * expr.c (java_truthvalue_conversion): Adjust fall through comment. * jcf-io.c (verify_constant_pool): Likewise. * typeck.c (promote_type): Likewise. gcc/objc/ * objc-encoding.c (encode_type): Add FALLTHRU. libcpp/ * lex.c (search_line_fast): Add FALLTHRU. (_cpp_lex_direct): Likewise. (cpp_token_val_index): Adjust fall through comment. * macro.c (parse_params): Add FALLTHRU. * pch.c (count_defs): Adjust fall through comment. (write_defs): Likewise. libiberty/ * cp-demangle.c (d_print_mod): Add FALLTHRU. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@239410 138bc75d-0d04-0410-961f-82ee72b054a4
* 2016-05-07 Fritz Reese <fritzoreese@gmail.com>kargl2016-05-071-32/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235999 138bc75d-0d04-0410-961f-82ee72b054a4
* 2016-02-07 Jerry DeLisle <jvdelisle@gcc.gnu.org>jvdelisle2016-02-071-0/+10
| | | | | | | | | | | | | | PR fortran/50555 * primary.c (match_actual_arg): If symbol has attribute flavor of namelist, generate an error. (gfc_match_rvalue): Likewise return MATCH_ERROR. * resolve.c (resolve_symbol): Scan arument list of procedures and generate an error if a namelist is found. PR fortran/50555 * gfortran.dg/namelist_args.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@233203 138bc75d-0d04-0410-961f-82ee72b054a4
* 2016-01-24 Dominique d'Humieres <dominiq@lps.ens.fr>dominiq2016-01-241-17/+4
| | | | | | | | | | | | | | | | PR fortran/68283 * primary.c (gfc_variable_attr): revert revision r221955, call gfc_internal_error only if there is no error. 2016-01-24 Dominique d'Humieres <dominiq@lps.ens.fr> PR fortran/68283 gfortran.dg/pr68283.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232775 138bc75d-0d04-0410-961f-82ee72b054a4
* Update copyright years.jakub2016-01-041-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232055 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-11-18 Steven G. Kargl <kargl@gcc.gnu.org>kargl2015-11-181-0/+6
| | | | | | | | | | | | | | PR fortran/59910 * primary.c (gfc_match_structure_constructor): Reduce a structure constructor in a DATA statement. 2015-11-18 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/59910 * gfortran.dg/pr59910.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230580 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-11-17 Steven G. Kargl <kargl@gcc.gnu.org>kargl2015-11-171-15/+15
| | | | | | | * primary.c (gfc_match_structure_constructor): Fix whitespace. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230495 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-10-18 Paul Thomas <pault@gcc.gnu.org>pault2015-10-181-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | PR fortran/67177 PR fortran/67977 * primary.c (match_substring): Add an argument 'deferred' to flag that a substring reference with null start and end should not be optimized away for deferred length strings. (match_string_constant, gfc_match_rvalue): Set the argument. * trans-expr.c (alloc_scalar_allocatable_for_assignment): If there is a substring reference return. * trans-intrinsic.c (conv_intrinsic_move_alloc): For deferred characters, assign the 'from' string length to the 'to' string length. If the 'from' expression is deferred, set its string length to zero. If the 'to' expression has allocatable components, deallocate them. 2015-10-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/67177 * gfortran.dg/move_alloc_15.f90: New test * gfortran.dg/move_alloc_16.f90: New test PR fortran/67977 * gfortran.dg/deferred_character_assignment_1.f90: New test git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228940 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-10-01 Steven G. Kargl <kargl@gcc.gnu.org>kargl2015-10-021-1/+1
| | | | | | | | | | | | | | PR fortran/67616 * primary.c (gfc_match_structure_constructor): Use a possibly host-associated symtree to prevent ICE. 2015-10-01 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/67616 * gfortran.dg/pr67616.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@228363 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-07-09 Andrew MacLeod <amacleod@redhat.com>amacleod2015-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * flags.h: Don't include flag-types.h or options.h. * opts-common.c: Adjust includes. * opts-global.c: Likewise. * common/config/epiphany/epiphany-common.c: Likewise. c * c-array-notation.c: Adjust includes for flags.h changes. * c-objc-common.c: Likewise. c-family * c-common.h: Adjust includes for flags.h changes. * stub-objc.c: Likewise. fortran * arith.c: Adjust includes for flags.h changes. * array.c: Likewise. * check.c: Likewise. * decl.c: Likewise. * error.c: Likewise. * expr.c: Likewise. * frontend-passes.c: Likewise. * interface.c: Likewise. * intrinsic.c: Likewise. * io.c: Likewise. * match.c: Likewise. * openmp.c: Likewise. * parse.c: Likewise. * primary.c: Likewise. * resolve.c: Likewise. * scanner.c: Likewise. * simplify.c: Likewise. * symbol.c: Likewise. * target-memory.c: Likewise. jit * dummy-frontend.c: Adjust includes for flags.h changes. * jit-common.h: Likewise. * jit-playback.c: Likewise. lto * lto-lang.c: Adjust includes for flags.h changes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225608 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-07-02 Paul Thomas <pault@gcc.gnu.org>pault2015-07-021-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR fortran/52846 * decl.c (get_proc_name): Make a partially populated interface symbol to carry the characteristics of a module procedure and its result. (variable_decl): Declarations of dummies or results in the abreviated form of module procedure is an error. (gfc_match_import): IMPORT is not permitted in the interface declaration of module procedures. (match_attr_spec): Submodule variables have implicit save attribute for F2008 onwards. (gfc_match_prefix): Add 'module' as the a prefix and set the module_procedure attribute. (gfc_match_formal_arglist): For a module procedure keep the interface formal_arglist from the interface, match new the formal arguments and then compare the number and names of each. (gfc_match_procedure): Add case COMP_SUBMODULE. (gfc_match_function_decl, gfc_match_subroutine_decl): Set the module_procedure attribute. (gfc_match_entry, gfc_match_end): Add case COMP_SUBMODULE. If attr abr_modproc_decl is set, switch the message accordingly for subroutines and functions. (gfc_match_submod_proc): New function to match the abbreviated style of submodule declaration. * gfortran.h : Add ST_SUBMODULE and ST_END_SUBMODULE. Add the attribute bits 'used_in_submodule' and 'module_procedure'. Add the bit field 'abr_modproc_decl' to gfc_symbol. Add prototypes for 'gfc_copy_dummy_sym', 'gfc_check_dummy_characteristics' and 'gfc_check_result_characteristics'. * interface.c : Add the prefix 'gfc_' to the names of functions 'check_dummy(result)_characteristics' and all their references. * match.h : Add prototype for 'gfc_match_submod_proc' and 'gfc_match_submodule'. (check_sym_interfaces): A module procedure is not an error in a module procedure statment in a generic interface. * module.c (gfc_match_submodule): New function. Add handling for the 'module_procedure' attribute bit. (gfc_use_module): Make sure that a submodule cannot use itself. * parse.c (decode_statement): Set attr has_'import_set' for the interface declaration of module procedures. Handle a match occurring in 'gfc_match_submod_proc' and a match for 'submodule'. (gfc_enclosing_unit): Include the state COMP_SUBMODULE. (gfc_ascii_statement): Add END SUBMODULE. (accept_statement): Add ST_SUBMODULE. (parse_spec): Disallow statement functions in a submodule specification part. (parse_contained): Add ST_END_SUBMODULE and COMP_SUBMODULE twice each. (get_modproc_result): Copy the result symbol of the interface. (parse_progunit): Call it. (set_syms_host_assoc): Make symbols from the ancestor module and submodules use associated, as required by the standard and set all private components public. Module procedures 'external' attribute bit is reset and the 'used_in_submodule' bit is set. (parse_module): If this is a submodule, use the ancestor module and submodules. Traverse the namespace, calling 'set_syms_host_assoc'. Add ST_END_SUBMODULE and COMP_SUBMODULE. * parse.h : Add COMP_SUBMODULE. * primary.c (match_variable): Add COMP_SUBMODULE. * resolve.c (compare_fsyms): New function to compare the dummy characteristics of a module procedure with its interface. (resolve_fl_procedure): Compare the procedure, result and dummy characteristics of a module_procedure with its interface, using 'compare_fsyms' for the dummy arguments. * symbol.c (gfc_add_procedure): Suppress the check for existing procedures in the case of a module procedure. (gfc_add_explicit_interface): Skip checks that must fail for module procedures. (gfc_add_type): Allow a new type to be added to module procedures, their results or their dummy arguments. (gfc_copy_dummy_sym): New function to generate new dummy args and copy the characteristics from the interface. * trans-decl.c (gfc_sym_mangled_function_id): Module procedures must always have their names mangled as if they are symbols coming from a declaration in a module. (gfc_get_symbol_decl): Add 'used_in_submodule' to the assert. (gfc_finish_var_decl): Symbols with the 'used_in_submodule' bit set are set DECL_EXTERNAL as if they were use associated. 2015-07-02 Paul Thomas <pault@gcc.gnu.org> PR fortran/52846 * gfortran.dg/submodule_1.f90: New test * gfortran.dg/submodule_2.f90: New test * gfortran.dg/submodule_3.f90: New test * gfortran.dg/submodule_4.f90: New test * gfortran.dg/submodule_5.f90: New test * gfortran.dg/submodule_6.f90: New test * gfortran.dg/submodule_7.f90: New test git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225354 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-07-02 Steven G. Kargl <kargl@gcc.gnu.org>kargl2015-07-021-0/+3
| | | | | | | | | | | | | | PR fortran/66545 * primary.c (match_sym_complex_part): Do not dereference NULL pointer. 2015-07-02 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/66545 * gfortran.dg/pr66545_1.f90: New test. * gfortran.dg/pr66545_2.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225348 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc/fortran/ChangeLog:vehre2015-06-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 2015-06-23 Andre Vehreschild <vehre@gmx.de> PR fortran/64674 * parse.c (parse_associate): Figure the rank and as of a class array in an associate early. * primary.c (gfc_match_varspec): Prevent setting the dimension attribute on the sym for classes. * resolve.c (resolve_variable): Correct the component ref's type for associated variables. Add a full array ref when class array's are associated. (resolve_assoc_var): Correct the type of the symbol, when in the associate the expression's rank becomes scalar. * trans-expr.c (gfc_conv_variable): Indirect ref needed for allocatable associated objects. gcc/testsuite/ChangeLog: 2015-06-23 Andre Vehreschild <vehre@gmx.de> PR fortran/64674 * gfortran.dg/associate_18.f08: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224827 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-06-06 Thomas Koenig <tkoenig@netcologne.de>tkoenig2015-06-061-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR fortran/47359 * arith.c (eval_intrinsic_op): Set warn flag for gfc_type_convert_binary if -Wconversion or -Wconversion-extra are set. (wprecision_real_real): New function. (wprecision_int_real): New function. (gfc_int2int): If -fno-range-check and -Wconversion are specified and it is a narrowing conversion, warn. (gfc_int2real): If there is a change in value for the conversion, warn. (gfc_int2complex): Likewise. (gfc_real2int): If there is a fractional part to the real number, warn with -Wconversion, otherwise warn with -Wconversion-extra. (gfc_real2real): Emit warning if the constant was changed by conversion with either -Wconversion or -Wconversion-extra. With -Wconversion-extra, warn if no warning was issued earlier. (gfc_real2complex): Likewise. (gfc_complex2int): For -Wconversion or -Wconversion-extra, if there was an imaginary part, warn; otherwise, warn for change in value. Warn with -Wconversion-extra if no other warning was issued. (gfc_complex2real): For -Wconversion or -Wconversion-extra, if there was an imaginary part, warn; otherwise, warn for change in value. Warn with -Wconversion-extra if no other warning was issued. (gfc_complex2complex): For -Wconversion, warn if the value of either the real or the imaginary part was changed. Warn for -Wconversion-extra if no prior warning was issued. * expr.c (gfc_check_assign): Remove check for change in value. * primary.c (match_real_constant): For -Wconversion-extra, check against a number in which the last non-zero digit has been replaced with a zero. If the number compares equal, warn. * intrinsic.c (gfc_convert_type_warn): Do not warn about constant conversions. 2015-06-06 Thomas Koenig <tkoenig@netcologne.de> PR fortran/47359 * gfortran.dg/array_constructor_type_17.f03: Adjust error message. * gfortran.dg/warn_conversion.f90: Add warning for change in value for assignment. * gfortran.dg/warn_conversion_3.f90: Add warnings. * gfortran.dg/warn_conversion_5.f90: New test. * gfortran.dg/warn_conversion_6.f90: New test. * gfortran.dg/warn_conversion_7.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@224190 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc/fortran/ChangeLog:manu2015-05-231-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2015-05-24 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * gfortran.h (struct gfc_error_buf): Rename as gfc_error_buffer. Move closer to push, pop and free methods. Reimplement using an output_buffer. * error.c (errors, warnings, warning_buffer, cur_error_buffer): Delete everywhere in this file. (error_char): Delete all contents. (gfc_increment_error_count): Delete. (gfc_error_now): Update comment. Set error_buffer.flag. (gfc_warning_check): Do not handle warning_buffer. (gfc_error_1): Delete. (gfc_error_now_1): Delete. (gfc_error_check): Simplify. (gfc_move_error_buffer_from_to): Renamed from gfc_move_output_buffer_from_to. (gfc_push_error): Handle only gfc_error_buffer. (gfc_pop_error): Likewise. (gfc_free_error): Likewise. (gfc_get_errors): Remove warnings and errors. (gfc_diagnostics_init): Use static error_buffer. (gfc_error_1,gfc_error_now_1): Delete declarations. * symbol.c, decl.c, trans-common.c, data.c, expr.c, expr.c, frontend-passes.c, resolve.c, match.c, parse.c: Replace gfc_error_1 with gfc_error and gfc_error_now_1 with gfc_error_1 everywhere. * f95-lang.c (gfc_be_parse_file): Do not update errorcount and warningcount here. * primary.c (match_complex_constant): Replace gfc_error_buf and output_buffer with gfc_error_buffer. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223614 138bc75d-0d04-0410-961f-82ee72b054a4
* 2013-04-09 Paul Thomas <pault@gcc.gnu.org>pault2015-04-091-18/+36
| | | | | | | | | | | | | | PR fortran/56852 * primary.c (gfc_variable_attr): Avoid ICE on AR_UNKNOWN if any of the index variables are untyped and errors are present. 2013-04-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/56852 * gfortran.dg/pr56852.f90 : New test git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221955 138bc75d-0d04-0410-961f-82ee72b054a4
* Always pass 0 or option number to gfc_warning*.jsm282015-02-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Similar to the issue with fatal_error that I fixed in <https://gcc.gnu.org/ml/gcc-patches/2015-01/msg02690.html>, the overloads of gfc_warning and gfc_warning_now (with and without a first argument for an option number) also break gcc.pot regeneration because xgettext expects the translated string argument to be in a fixed position for a given function name. This patch applies the corresponding fix of always passing a first argument (option number or 0), just like the core diagnostic functions warning and warning_at, and removing the problem overloads without it. Bootstrapped with no regressions on x86_64-unknown-linux-gnu. * error.c (gfc_warning (const char *, ...), gfc_warning_now (const char *, ...)): Remove functions. * gfortran.h (gfc_warning (const char *, ...), gfc_warning_now (const char *, ...)): Remove declarations. * arith.c, check.c, data.c, decl.c, frontend-passes.c, interface.c, intrinsic.c, io.c, matchexp.c, module.c, openmp.c, options.c, parse.c, primary.c, resolve.c, scanner.c, symbol.c, trans-common.c, trans-const.c, trans-stmt.c: All callers of gfc_warning and gfc_warning_now changed to pass 0 or option number as first argument. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@220313 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-01-18 Paul Thomas <pault@gcc.gnu.org>pault2015-01-181-1/+4
| | | | | | | | | | | | | | | | | | | | | | PR fortran/55901 * primary.c (gfc_match_varspec): Exclude dangling associate- names with dimension 0 from being counted as arrays. * resolve.c (resolve_assoc_var): Sub-strings are permissible for associate-names, so exclude characters from the test for misuse as arrays. * trans-decl.c (gfc_get_symbol_decl): Associate-names can use the hidden string length variable of their associated target. Signal this by setting 'length' to a constant, if the decl for the string length is a variable. 2015-01-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/55901 * gfortran.dg/associate_1.f03: Allow test for character with automatic length. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219814 138bc75d-0d04-0410-961f-82ee72b054a4
* 2015-01-17 Andre Vehreschild <vehre@gmx.de>pault2015-01-171-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR fortran/60357 * primary.c (build_actual_constructor): Prevent warning. * trans-expr.c (alloc_scalar_allocatable_for_subcomponent_ assignment): New function encapsulates treatment of allocatable components. (gfc_trans_subcomponent_assign): Needed to distinguish between regular assignment and initilization. (gfc_trans_structure_assign): Same. (gfc_conv_structure): Same. PR fortran/61275 * gfortran.h: deferred_parameter is not needed, because it artificial does the trick completely. * primary.c (build_actual_constructor): Same. (gfc_convert_to_structure_constructor): Same. * resolve.c (resolve_fl_derived0): Same. * trans-expr.c (gfc_conv_component_ref): Prevent treating allocatable deferred length char arrays here. (gfc_trans_subcomponent_assign): Same as above. * trans-types.c (gfc_sym_type): This is done in gfc_get_derived_type already. 2015-01-17 Andre Vehreschild <vehre@gmx.de> PR fortran/60357 * gfortran.dg/alloc_comp_assign_13.f08: New test. PR fortran/61275 * gfortran.dg/alloc_comp_assign_14.f08: New test. PR fortran/55932 * gfortran.dg/alloc_comp_initializer_4.f03: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219801 138bc75d-0d04-0410-961f-82ee72b054a4
* Update copyright years.jakub2015-01-051-1/+1
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219188 138bc75d-0d04-0410-961f-82ee72b054a4
* 2014-12-29 Janus Weil <janus@gcc.gnu.org>janus2014-12-291-0/+7
| | | | | | | | | | | | | | | | | PR fortran/60357 * array.c (check_constructor): Ignore empty expressions. * expr.c (check_alloc_comp_init): Check if constructor expression exists. * primary.c (build_actual_constructor): Warn for absent alloc-comp initializers in pre-2008 standards. 2014-12-29 Janus Weil <janus@gcc.gnu.org> PR fortran/60357 * gfortran.dg/alloc_comp_constructor_7.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219098 138bc75d-0d04-0410-961f-82ee72b054a4
* 2014-12-16 Tobias Burnus <burnus@net-b.de>burnus2014-12-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR fortran/54687 * gfortran.h (gfc_option_t): Remove flags which now have a Var(). * lang.opt (flag-aggressive_function_elimination, flag-align_commons, flag-all_intrinsics, flag-allow_leading_underscore, flag-automatic, flag-backslash, flag-backtrace, flag-blas_matmul_limit, flag-cray_pointer, flag-dollar_ok, flag-dump_fortran_original, flag-dump_fortran_optimized, flag-external_blas, flag-f2c, flag-implicit_none, flag-max_array_constructor, flag-module_private, flag-pack_derived, flag-range_check, flag-recursive, flag-repack_arrays, flag-sign_zero, flag-underscoring): Add Var() and, where applicable, Enum(). * options.c (gfc_init_options, gfc_post_options, gfc_handle_option): Update for *.opt changes. * arith.c: Update for flag-variable name changes. * array.c: Ditto. * cpp.c: Ditto. * decl.c: Ditto. * expr.c: Ditto. * f95-lang.c: Ditto. * frontend-passes.c: Ditto. * intrinsic.c: Ditto. * io.c: Ditto. * match.c: Ditto. * module.c: Ditto. * parse.c: Ditto. * primary.c: Ditto. * resolve.c: Ditto. * scanner.c: Ditto. * simplify.c: Ditto. * symbol.c: Ditto. * trans-array.c: Ditto. * trans-common.c: Ditto. * trans-decl.c: Ditto. * trans-expr.c: Ditto. * trans-intrinsic.c: Ditto. * trans-openmp.c: Ditto. * trans-types.c: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218792 138bc75d-0d04-0410-961f-82ee72b054a4
* 2014-12-15 Tobias Burnus <burnus@net-b.de>burnus2014-12-161-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lang.opt (fsecond-underscore, frecord-marker=8, * frecord-marker=4, frealloc-lhs, freal-8-real-16, freal-8-real-10, freal-8-real-4, freal-4-real-16, freal-4-real-10, freal-4-real-8, fprotect-parens, fstack-arrays, fmax-stack-var-size=, fmax-subrecord-length=, ffrontend-optimize, ffree-line-length-, ffixed-line-length-, finteger-4-integer-8, fdefault-real-8, fdefault-integer-8, fdefault-double-8): Add Var() and Init(). * gfortran.h (gfc_option_t): Remove moved flags. * options.c (gfc_init_options, gfc_handle_option): Ditto. (gfc_post_options): Update for name change. * decl.c (gfc_match_old_kind_spec, gfc_match_kind_spec): Handle flag-name change. * frontend-passes.c (gfc_run_passes): Ditto. * module.c (use_iso_fortran_env_module): Ditto. * primary.c (match_integer_constant, match_real_constant): * Ditto. * resolve.c (resolve_ordinary_assign): Ditto. * scanner.c (gfc_next_char_literal, load_line): Ditto. * trans-array.c (gfc_trans_allocate_array_storage, gfc_conv_resolve_dependencies, gfc_trans_auto_array_allocation, gfc_conv_ss_startstride): Ditto. * trans-common.c (gfc_sym_mangled_common_id): Ditto. * trans-decl.c (gfc_sym_mangled_function_id, create_main_function): Ditto. * trans-expr.c (gfc_conv_expr_op, gfc_conv_procedure_call, arrayfunc_assign_needs_temporary, gfc_trans_arrayfunc_assign, gfc_trans_assignment_1): Ditto. * trans-stmt.c (gfc_trans_allocate): Ditto. * trans-types.c (gfc_init_kinds): Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218790 138bc75d-0d04-0410-961f-82ee72b054a4
* 2014-12-13 Tobias Burnus <burnus@net-b.de>burnus2014-12-121-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Manuel López-Ibáñez <manu@gcc.gnu.org> fortran/ * error.c (gfc_error): Add variant which takes a va_list. (gfc_notify_std): Convert to common diagnostic. * array.c: Use %qs, %<...%> in more gfc_error calls and for gfc_notify_std. * check.c: Ditto. * data.c: Ditto. * decl.c: Ditto. * expr.c: Ditto. * interface.c: Ditto. * intrinsic.c: Ditto. * io.c: Ditto. * match.c: Ditto. * matchexp.c: Ditto. * module.c: Ditto. * openmp.c: Ditto. * parse.c: Ditto. * primary.c: Ditto. * resolve.c: Ditto. * simplify.c: Ditto. * symbol.c: Ditto. * trans-common.c: Ditto. * trans-intrinsic.c: Ditto. gcc/testsuite/ * gfortran.dg/realloc_on_assign_21.f90: Update dg-error. * gfortran.dg/warnings_are_errors_1.f: Ditto. * gfortran.dg/warnings_are_errors_1.f90: Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218694 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc/ChangeLog:manu2014-12-111-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2014-12-11 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * diagnostic.c (diagnostic_action_after_output): Make it extern. Take diagnostic_t argument instead of diagnostic_info. Count also DK_WERROR towards max_errors. (diagnostic_report_diagnostic): Update call according to the above. (error_recursion): Likewise. * diagnostic.h (diagnostic_action_after_output): Declare. * pretty-print.c (pp_formatted_text_data): Delete. (pp_append_r): Call output_buffer_append_r. (pp_formatted_text): Call output_buffer_formatted_text. (pp_last_position_in_text): Call output_buffer_last_position_in_text. * pretty-print.h (output_buffer_formatted_text): New. (output_buffer_append_r): New. (output_buffer_last_position_in_text): New. gcc/testsuite/ChangeLog: 2014-12-11 Manuel López-Ibáñez <manu@gcc.gnu.org> * gfortran.dg/do_iterator.f90: Remove bogus dg-warning. gcc/fortran/ChangeLog: 2014-12-11 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * error.c (pp_error_buffer): New static variable. (pp_warning_buffer): Make it a pointer. (gfc_output_buffer_empty_p): New. (gfc_error_init_1): Call gfc_buffer_error. (gfc_buffer_error): Do not use pp_warning_buffer.flush_p as the buffered_p flag. (gfc_clear_warning): Likewise. (gfc_warning_check): Call gfc_clear_warning. Only check the new pp_warning_buffer if the old warning_buffer was empty. Call diagnostic_action_after_output. (gfc_error_1): Renamed from gfc_error. (gfc_error): New. (gfc_clear_error): Clear also pp_error_buffer. (gfc_error_flag_test): Check also pp_error_buffer. (gfc_error_check): Likewise. Only check the new pp_error_buffer if the old error_buffer was empty. (gfc_move_output_buffer_from_to): New. (gfc_push_error): Use it here. Take also an output_buffer as argument. (gfc_pop_error): Likewise. (gfc_free_error): Likewise. (gfc_diagnostics_init): Use XNEW and placement-new to init pp_error_buffer and pp_warning_buffer. Set flush_p to false for both pp_warning_buffer and pp_error_buffer. * Update gfc_push_error, gfc_pop_error and gfc_free_error calls according to the above changes. * Use gfc_error_1 for all gfc_error calls that use multiple locations. * Use %qs instead of '%s' for many gfc_error calls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218627 138bc75d-0d04-0410-961f-82ee72b054a4
* gcc/testsuite/ChangeLog:manu2014-12-031-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2014-12-03 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * gfortran.dg/warnings_are_errors_1.f90: Update warnings to errors. * gfortran.dg/warnings_are_errors_1.f: Likewise. gcc/fortran/ChangeLog: 2014-12-03 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * gfortran.h (gfc_warning): Now returns bool. Add overload that accepts opt. (gfc_warning_1): Declare. * error.c (pp_warning_buffer,warningcount_buffered,werrorcount_buffered): New. (gfc_buffer_error): Set pp_warning_buffer.flush_p. (gfc_clear_pp_buffer): New. (gfc_warning_1): Renamed from gfc_warning. (gfc_warning): Add three new overloads. One that takes just a format string and ellipsis, another that takes also a warning option, and another that takes also va_list instead of ellipsis. (gfc_clear_warning): Clear pp_warning_buffer. (gfc_warning_check): Flush pp_warning_buffer and update warning and werror counters. (gfc_diagnostics_init): Init pp_warning_buffer. * Update all gfc_warning calls that do not multiple locations to use %qs and OPT_W*, otherwise use gfc_warning_1. gcc/ChangeLog: 2014-12-03 Manuel López-Ibáñez <manu@gcc.gnu.org> PR fortran/44054 * pretty-print.c (output_buffer::output_buffer): Init flush_p to true. (pp_flush): Flush only if flush_p. (pp_really_flush): New. * pretty-print.h (struct output_buffer): Add flush_p. (pp_really_flush): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218326 138bc75d-0d04-0410-961f-82ee72b054a4
* 2014-11-30 Tobias Burnus <burnus@net-b.de>burnus2014-11-301-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * gfortran.h (gfc_option_t): Remove warn_aliasing, * warn_ampersand, warn_function_elimination, warn_implicit_interface, warn_implicit_procedure, warn_line_truncation, warn_surprising, warn_underflow, warn_intrinsic_shadow, warn_array_temp, warn_align_commons, warn_real_q_constant, warn_unused_dummy_argument, warn_zerotrip, warn_realloc_lhs, warn_realloc_lhs_all, warn_compare_reals, warn_target_lifetime. * arith.c (check_result, gfc_real2real, gfc_real2complex, gfc_complex2real, gfc_complex2complex): Honor changed variable names. * check.c (gfc_check_transfer): Ditto. * expr.c (gfc_check_assign, gfc_check_pointer_assign): Ditto. * interface.c (compare_parameter, gfc_procedure_use, * gfc_ppc_use, gfc_arglist_matches_symbol): Ditto. * intrinsic.c (gfc_warn_intrinsic_shadow): Ditto. * primary.c (match_real_constant, match_string_constant): Ditto. * resolve.c (gfc_resolve_intrinsic, resolve_operator, gfc_resolve_iterator, resolve_select, resolve_ordinary_assign, resolve_charlen, gfc_resolve_finalizers): Ditto. * scanner.c (gfc_next_char_literal): Ditto. * simplify.c (simplify_achar_char, gfc_simplify_iachar): Ditto. * trans-array.c (gfc_trans_create_temp_array, gfc_trans_dummy_array_bias, gfc_conv_array_parameter): Ditto. * trans-common.c (translate_common): * trans-decl.c (generate_local_decl): Ditto. * trans-expr.c (realloc_lhs_warning): Ditto. * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ditto. * decl.c (do_warn_intrinsic_shadow): Ditto. Renamed from warn_intrinsic_shadow. * frontend-passes.c (do_warn_function_elimination): Honor changed variable names. Renamed from do_warn_function_elimination. * invoke.texi (Wunderflow): Document that it is enabled by * default. * lang.opt (Waliasing, Walign-commons, Warray-temporaries, Wcompare-reals, Wfunction-elimination, Wimplicit-interface, Wimplicit-procedure, Wline-truncation, Wreal-q-constant, Wrealloc-lhs, Wrealloc-lhs-all, Wtarget-lifetime, Wsurprising, Wunderflow, Wintrinsic-shadow, Wunused-dummy-argument, Wzerotrip): Use Var(), add Init() and LangEnabledBy() were required. (Wmaybe-uninitialized, Wreturn-type, Wuninitialized): Add LangEnabledBy. * options.c (gfc_init_options, gfc_post_options, * gfc_handle_option): Remove options handled in lang.opt; handle renaming. (set_Wall, set_Wextra): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218188 138bc75d-0d04-0410-961f-82ee72b054a4
* 2014-09-20 Joost VandeVondele <vondele@gcc.gnu.org>vondele2014-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * trans-expr.c (gfc_reset_vptr): Fix comment whitespace. (gfc_conv_class_to_class): Likewise. (gfc_conv_procedure_call): Likewise. (arrayfunc_assign_needs_temporary): Likewise. (realloc_lhs_loop_for_fcn_call): Likewise. (gfc_trans_assignment_1): Likewise. * trans-array.c (gfc_conv_array_ref): Likewise. (gfc_array_allocate): Likewise. (gfc_alloc_allocatable_for_assignment): Likewise. * symbol.c (generate_isocbinding_symbol): Likewise. * class.c (finalization_scalarizer): Likewise. (finalizer_insert_packed_call): Likewise. (generate_finalization_wrapper): Likewise. (find_intrinsic_vtab): Likewise. * decl.c (gfc_match_import): Likewise. (match_procedure_decl): Likewise. (gfc_match_subroutine): Likewise. (gfc_match_bind_c): Likewise. (gfc_match_volatile): Likewise. * trans-common.c (create_common): Likewise. * error.c (gfc_diagnostic_starter): Likewise. * trans-stmt.c (gfc_trans_sync): Likewise. (gfc_trans_critical): Likewise. (gfc_trans_simple_do): Likewise. (gfc_trans_do): Likewise. (gfc_trans_where_assign): Likewise. * expr.c (gfc_is_simply_contiguous): Likewise. * module.c (unquote_string): Likewise. * trans.c (gfc_add_finalizer_call): Likewise. * trans-types.c (gfc_init_kinds): Likewise. * scanner.c (preprocessor_line): Likewise. * gfortranspec.c (lang_specific_driver): Likewise. * frontend-passes.c (create_var): Likewise. (cfe_expr_0): Likewise. * resolve.c (check_host_association): Likewise. (gfc_resolve_code): Likewise. (resolve_fl_derived0): Likewise. (resolve_symbol): Likewise. * f95-lang.c (poplevel): Likewise. * trans-decl.c (create_main_function): Likewise. * trans-io.c (transfer_expr): Likewise. * arith.c (gfc_arith_divide): Likewise. * parse.c (resolve_all_program_units): Likewise. * check.c (gfc_check_rank): Likewise. (gfc_check_sizeof): Likewise. (is_c_interoperable): Likewise. * dependency.c (gfc_dep_difference): Likewise. * primary.c (gfc_match_rvalue): Likewise. * trans-intrinsic.c (conv_intrinsic_system_clock): Likewise. (conv_isocbinding_subroutine): Likewise. * options.c (gfc_post_options): Likewise. (gfc_handle_fpe_option): Likewise. (gfc_get_option_string): Likewise. * simplify.c (simplify_transformation_to_scalar): Likewise. (gfc_simplify_spread): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215420 138bc75d-0d04-0410-961f-82ee72b054a4
* 2014-03-06 Paul Thomas <pault@gcc.gnu.org>janus2014-03-061-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Janus Weil <janus@gcc.gnu.org> PR fortran/51976 * gfortran.h (symbol_attribute): Add deferred_parameter attribute. * primary.c (build_actual_constructor): It is not an error if a missing component has the deferred_parameter attribute; equally, if one is given a value, it is an error. * resolve.c (resolve_fl_derived0): Remove error for deferred character length components. Add the hidden string length field to the structure. Give it the deferred_parameter attribute. * trans-array.c (duplicate_allocatable): Add a strlen field which is used as the element size if it is non-null. (gfc_duplicate_allocatable, gfc_copy_allocatable_data): Pass a NULL to the new argument in duplicate_allocatable. (structure_alloc_comps): Set the hidden string length as appropriate. Use it in calls to duplicate_allocatable. (gfc_alloc_allocatable_for_assignment): When a deferred length backend declaration is variable, use that; otherwise use the string length from the expression evaluation. * trans-expr.c (gfc_conv_component_ref): If this is a deferred character length component, the string length should have the value of the hidden string length field. (gfc_trans_subcomponent_assign): Set the hidden string length field for deferred character length components. Allocate the necessary memory for the string. (alloc_scalar_allocatable_for_assignment): Same change as in gfc_alloc_allocatable_for_assignment above. * trans-stmt.c (gfc_trans_allocate): Likewise. * trans-intrinsic (size_of_string_in_bytes): Make non-static. * trans-types.c (gfc_get_derived_type): Set the tree type for a deferred character length component. * trans.c (gfc_deferred_strlen): New function. * trans.h (size_of_string_in_bytes,gfc_deferred_strlen): New prototypes. 2014-03-06 Paul Thomas <pault@gcc.gnu.org> Janus Weil <janus@gcc.gnu.org> PR fortran/51976 * gfortran.dg/deferred_type_component_1.f90 : New test. * gfortran.dg/deferred_type_component_2.f90 : New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208386 138bc75d-0d04-0410-961f-82ee72b054a4