aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-array.h
AgeCommit message (Collapse)AuthorFilesLines
2020-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r279813
2019-12-06re PR fortran/92775 (Incorrect expression in DW_AT_byte_stride on an array)Jakub Jelinek1-1/+1
PR fortran/92775 * trans.h (struct lang_type, struct lang_decl): Remove span member. (GFC_DECL_SPAN, GFC_TYPE_ARRAY_SPAN): Remove macros. * trans-array.h (gfc_get_descriptor_offsets_for_info): Add another argument. * trans-array.c (gfc_get_descriptor_offsets_for_info): Add SPAN_OFF argument and initialize *SPAN_OFF to the offset of span field. * trans-types.c (gfc_get_array_descr_info): Adjust gfc_get_descriptor_offsets_for_info caller. Compute elem_size as base->span instead of TYPE_SIZE_UNIT (etype) constant. From-SVN: r279045
2019-09-26CO_BROADCAST for derived types with allocatable componentsAlessandro Fanfarillo1-0/+2
From-SVN: r276164
2019-01-24re PR fortran/88929 (ICE on building MPICH 3.2 with GCC 9 with ↵Paul Thomas1-0/+1
ISO_Fortran_binding) 2019-01-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/88929 * trans-array.c (gfc_conv_descriptor_elem_len): New function. * trans-array.h : Add prototype for above. * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Take account of assumed rank arrays being flagged by rank = -1 in expressions. Intent in arrays need a pointer to a copy of the data to be assigned to the descriptor passed for conversion. This should then be freed, together with the CFI descriptor on return from the C call. 2019-01-24 Paul Thomas <pault@gcc.gnu.org> PR fortran/88929 * gfortran.dg/ISO_Fortran_binding_3.f90 : New test * gfortran.dg/ISO_Fortran_binding_3.c : Subsidiary source. From-SVN: r268231
2019-01-12gfortran.texi: Add description in sections on TS 29113 and further ↵Paul Thomas1-0/+3
interoperability with C. 2019-01-12 Paul Thomas <pault@gcc.gnu.org> * gfortran.texi : Add description in sections on TS 29113 and further interoperability with C. * trans-array.c (gfc_conv_descriptor_attribute): New function. (gfc_get_dataptr_offset): Remove static function attribute. * trans-array.h : Add prototypes for above functions. * trans-decl.c : Add declarations for the library functions cfi_desc_to_gfc_desc and gfc_desc_to_cfi_desc. * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): New function. (gfc_conv_procedure_call): Call it for scalar and array actual arguments, when the formal arguments are bind_c with assumed shape or assumed rank. * trans.h : External declarations for gfor_fndecl_cfi_to_gfc and gfor_fndecl_gfc_to_cfi. 2019-01-12 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/ISO_Fortran_binding_1.f90 : New test. * gfortran.dg/ISO_Fortran_binding_1.c : Auxilliary file for test. * gfortran.dg/ISO_Fortran_binding_2.f90 : New test. * gfortran.dg/ISO_Fortran_binding_2.c : Auxilliary file for test. * gfortran.dg/bind_c_array_params_2.f90 : Change search string for dump tree scan. 2019-01-12 Paul Thomas <pault@gcc.gnu.org> * ISO_Fortran_binding.h : New file. * Makefile.am : Include ISO_Fortran_binding.c in the list of files to compile. * Makefile.in : Regenerated. * gfortran.map : Add _gfortran_cfi_desc_to_gfc_desc, _gfortran_gfc_desc_to_cfi_desc and the CFI API functions. * runtime/ISO_Fortran_binding.c : New file containing the new functions added to the map. From-SVN: r267881
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-05-20re PR fortran/49636 ([F03] ASSOCIATE construct confused with slightly ↵Paul Thomas1-0/+2
complicated case) 2018-05-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/49636 * trans-array.c (gfc_get_array_span): Renamed from 'get_array_span'. (gfc_conv_expr_descriptor): Change references to above. * trans-array.h : Add prototype for 'gfc_get_array_span'. * trans-stmt.c (trans_associate_var): If the associate name is a subref array pointer, use gfc_get_array_span for the span. 2018-05-20 Paul Thomas <pault@gcc.gnu.org> PR fortran/49636 * gfortran.dg/associate_38.f90: New test. From-SVN: r260414
2018-01-03Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r256169
2017-09-10re PR fortran/34640 (ICE when assigning item of a derived-component to a ↵Paul Thomas1-0/+5
pointer) 2017-09-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/34640 PR fortran/40737 PR fortran/55763 PR fortran/57019 PR fortran/57116 * expr.c (is_subref_array): Add class pointer array dummies to the list of expressions that return true. * trans-array.c: Add SPAN_FIELD and update indices for subsequent fields. (gfc_conv_descriptor_span, gfc_conv_descriptor_span_get, gfc_conv_descriptor_span_set, is_pointer_array, get_array_span): New functions. (gfc_get_descriptor_offsets_for_info): New function to preserve API for access to descriptor fields for trans-types.c. (gfc_conv_scalarized_array_ref): If the expression is a subref array, make sure that info->descriptor is a descriptor type. Otherwise, if info->descriptor is a pointer array, set 'decl' and fix it if it is a component reference. (build_array_ref): Simplify handling of class array refs by passing the vptr to gfc_build_array_ref rather than generating the pointer arithmetic in this function. (gfc_conv_array_ref): As in gfc_conv_scalarized_array_ref, set 'decl'. (gfc_array_allocate): Set the span field if this is a pointer array. Use the expr3 element size if it is available, so that the dynamic type element size is used. (gfc_conv_expr_descriptor): Set the span field for pointer assignments. * trans-array.h: Prototypes for gfc_conv_descriptor_span_get gfc_conv_descriptor_span_set and gfc_get_descriptor_offsets_for_info added. trans-decl.c (gfc_get_symbol_decl): If a non-class pointer array, mark the declaration as a GFC_DECL_PTR_ARRAY_P. Remove the setting of GFC_DECL_SPAN. (gfc_trans_deferred_vars): Set the span field to zero in thge originating scope. * trans-expr.c (gfc_conv_procedure_call): Do not use copy-in/ copy-out to pass subref expressions to a pointer dummy. (gfc_trans_pointer_assignment): Remove code for setting of GFC_DECL_SPAN. Set the 'span' field for non-class pointers to class function results. Likewise for rank remap. In the case that the target is not a whole array, use the target array ref for remap and, since the 'start' indices are missing, set the lbounds to one, as required by the standard. * trans-intrinsic.c (conv_expr_ref_to_caf_ref): Pick up the 'token' offset from the field decl in the descriptor. (conv_isocbinding_subroutine): Set the 'span' field. * trans-io.c (gfc_trans_transfer): Always scalarize pointer array io. * trans-stmt.c (trans_associate_var): Set the 'span' field. * trans-types.c (gfc_get_array_descriptor_base): Add the 'span' field to the array descriptor. (gfc_get_derived_type): Pointer array components are marked as GFC_DECL_PTR_ARRAY_P. (gfc_get_array_descr_info): Replaced API breaking code for descriptor offset calling gfc_get_descriptor_offsets_for_info. * trans.c (get_array_span): New function. (gfc_build_array_ref): Simplify by calling get_array_span and obtain 'span' if 'decl' or 'vptr' present. * trans.h : Rename DECL_LANG_FLAG_6, GFC_DECL_SUBREF_ARRAY_P, as GFC_DECL_PTR_ARRAY_P. 2017-09-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/34640 * gfortran.dg/associate_24.f90: New test. * gfortran.dg/assumed_type_2.f90: Adjust some of the tree dump checks. * gfortran.dg/no_arg_check_2.f90: Likewise. * gfortran.dg/pointer_array_1.f90: New test. * gfortran.dg/pointer_array_2.f90: New test. * gfortran.dg/pointer_array_7.f90: New test. * gfortran.dg/pointer_array_8.f90: New test. * gfortran.dg/pointer_array_component_1.f90: New test. * gfortran.dg/pointer_array_component_2.f90: New test. * gfortran.dg/goacc/kernels-alias-4.f95: Bump up both tree scan counts by 1. PR fortran/40737 * gfortran.dg/pointer_array_3.f90: New test. PR fortran/57116 * gfortran.dg/pointer_array_4.f90: New test. PR fortran/55763 * gfortran.dg/pointer_array_5.f90: New test. PR fortran/57019 * gfortran.dg/pointer_array_6.f90: New test. 2017-09-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/34640 * libgfortran/libgfortran.h: Add span field to descriptor. * libgfortran/libtool-version : Bump up version number to 5:0:0. From-SVN: r251949
2017-09-09decl.c: Add decl_type_param_list...Paul Thomas1-0/+4
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-01-07re PR fortran/78781 ([Coarray] ICE in gfc_deallocate_scalar_with_status, at ↵Andre Vehreschild1-1/+1
fortran/trans.c:1588) gcc/fortran/ChangeLog: 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. From-SVN: r244196
2017-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r243994
2016-12-09trans-array.c (gfc_array_deallocate): Remove wrapper.Andre Vehreschild1-5/+0
gcc/fortran/ChangeLog: 2016-12-09 Andre Vehreschild <vehre@gcc.gnu.org> * trans-array.c (gfc_array_deallocate): Remove wrapper. (gfc_trans_dealloc_allocated): Same. (structure_alloc_comps): Restructure deallocation of (nested) allocatable components. Insert dealloc of sub-component into the block guarded by the if != NULL for the component. (gfc_trans_deferred_array): Use the almightly deallocate_with_status. * trans-array.h: Remove prototypes. * trans-expr.c (gfc_conv_procedure_call): Use the almighty deallocate_ with_status. * 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): Likewise. * trans.c (gfc_deallocate_with_status): Allow deallocation of scalar and arrays as well as coarrays. (gfc_deallocate_scalar_with_status): Get the data member for coarrays only when freeing an array with descriptor. And set correct caf_mode when freeing components of coarrays. * trans.h: Change prototype of gfc_deallocate_with_status to allow adding statements into the block guarded by the if (pointer != 0) and supply a coarray handle. gcc/testsuite/ChangeLog: 2016-12-09 Andre Vehreschild <vehre@gcc.gnu.org> * gfortran.dg/coarray_alloc_comp_3.f08: New test. * gfortran.dg/coarray_alloc_comp_4.f08: New test. * gfortran.dg/finalize_18.f90: Add count for additional guard against accessing null-pointer. * gfortran.dg/proc_ptr_comp_47.f90: New test. From-SVN: r243480
2016-11-30libcaf.h: Add new action types for (de-)registration of allocatable ↵Andre Vehreschild1-4/+6
components in derived... libgfortran/ChangeLog: 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. From-SVN: r243021
2016-01-04Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r232055
2015-06-15re PR fortran/44672 ([F08] ALLOCATE with SOURCE and no array-spec)Andre Vehreschild1-1/+1
gcc/testsuite/ChangeLog: 2015-06-15 Andre Vehreschild <vehre@gmx.de> PR fortran/44672 PR fortran/45440 PR fortran/57307 * gfortran.dg/allocate_with_source_3.f90: Removed check for unimplemented error. * gfortran.dg/allocate_with_source_7.f08: New test. * gfortran.dg/allocate_with_source_8.f08: New test. gcc/fortran/ChangeLog: 2015-06-15 Andre Vehreschild <vehre@gmx.de> PR fortran/44672 PR fortran/45440 PR fortran/57307 * gfortran.h: Extend gfc_code.ext.alloc to carry a flag indicating that the array specification has to be taken from expr3. * resolve.c (resolve_allocate_expr): Add F2008 notify and flag indicating source driven array spec. (resolve_allocate_deallocate): Check for source driven array spec, when array to allocate has no explicit array spec. * trans-array.c (gfc_array_init_size): Get lower and upper bound from a tree array descriptor, except when the source expression is an array-constructor which is fixed to be one-based. (retrieve_last_ref): Extracted from gfc_array_allocate(). (gfc_array_allocate): Enable allocate(array, source= array_expression) as specified by F2008:C633. (gfc_conv_expr_descriptor): Add class tree expression into the saved descriptor for class arrays. * trans-array.h: Add temporary array descriptor to gfc_array_allocate (). * trans-expr.c (gfc_conv_procedure_call): Special handling for _copy() routine translation, that comes without an interface. Third and fourth argument are now passed by value. * trans-stmt.c (gfc_trans_allocate): Get expr3 array descriptor for temporary arrays to allow allocate(array, source = array_expression) for array without array specification. From-SVN: r224477
2015-05-09Fix fortran/65894 elemental procedures wrong-codeMikael Morin1-0/+2
gcc/fortran/ 2015-05-09 Mikael Morin <mikael@gcc.gnu.org> PR fortran/65894 * trans-array.h (gfc_scalar_elemental_arg_saved_as_reference): New prototype. * trans-array.c (gfc_scalar_elemental_arg_saved_as_reference): New function. (gfc_add_loop_ss_code): Use gfc_scalar_elemental_arg_saved_as_reference as conditional. (gfc_walk_elemental_function_args): Set the dummy_arg field. * trans.h (gfc_ss_info): New subfield dummy_arg. * trans-expr.c (gfc_conv_procedure_call): Revert the change of revision 222361. (gfc_conv_expr): Use gfc_scalar_elemental_arg_saved_as_reference as conditional. gcc/testsuite/ 2015-05-09 Andre Vehreschild <vehre@gmx.de> PR fortran/65894 * gfortran.dg/elemental_subroutine_11.f90: New test. From-SVN: r222968
2015-05-06re PR fortran/37131 (inline matmul for small matrix sizes)Thomas Koenig1-2/+0
2015-05-06 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/37131 * gfortran.h (gfc_isym_id): Add GFC_ISYM_FE_RUNTIME_ERROR. (gfc_intrinsic_sym): Add vararg. * intrinsic.h (gfc_check_fe_runtime_error): Add prototype. (gfc_resolve_re_runtime_error): Likewise. Add prototype for gfc_is_reallocatable_lhs. * trans-array.h (gfc_is_reallocatable_lhs): Remove prototype. * check.c (gfc_check_fe_runtime_error): New function. * intrinsic.c (add_sym_1p): New function. (make_vararg): New function. (add_subroutines): Add fe_runtime_error. (gfc_intrinsic_sub_interface): Skip sorting for variable number of arguments. * iresolve.c (gfc_resolve_fe_runtime_error): New function. * lang.opt (inline-matmul-limit): New option. (gfc_post_options): If no inline matmul limit has been set and BLAS is called externally, use the BLAS limit. * frontend-passes.c: Include intrinsic.h. (var_num): New global counter for naming temporary variablbles. (matrix_case): Enum for differentiating the different matmul cases. (realloc_string_callback): Add "trim" to the variable name. (create_var): Add optional argument vname as part of the name. Use var_num. Set dimension of result correctly. Split off block creation into (insert_block): New function. (cfe_expr_0): Use "fcn" as part of temporary variable name. (optimize_namesapce): Also set gfc_current_ns. Call inline_matmul_assign. (combine_array_constructor): Use "constr" as part of temporary name. (get_array_inq_function): New function. (build_logical_expr): New function. (get_operand): new function. (inline_limit_check): New function. (runtime_error_ne): New function. (matmul_lhs_realloc): New function. (is_functino_or_op): New function. (has_function_or_op): New function. (freeze_expr): New function. (freeze_references): New function. (convert_to_index_kind): New function. (create_do_loop): New function. (get_size_m1): New function. (scalarized_expr): New function. (inline_matmul_assign): New function. * simplify.c (simplify_bound): Simplify the case of the lower bound of an assumed-shape argument. 2015-05-06 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/37131 * gfortran.dg/dependency_26.f90: Add option to suppress inlining matmul. * gfortran.dg/function_optimize_1.f90: Likewise. * gfortran.dg/function_optimize_2.f90: Likewise. * gfortran.dg/function_optimize_5.f90: Likewise. * gfortran.dg/function_optimize_7.f90: Likewise. * gfortran.dg/inline_matmul_1.f90: New test. * gfortran.dg/inline_matmul_2.f90: New test. * gfortran.dg/inline_matmul_3.f90: New test. * gfortran.dg/inline_matmul_4.f90: New test. * gfortran.dg/inline_matmul_5.f90: New test. * gfortran.dg/inline_matmul_6.f90: New test. From-SVN: r222864
2015-04-27re PR fortran/59678 ([F03] Segfault on equalizing variables of a complex ↵Andre Vehreschild1-1/+1
derived type) gcc/fortran 2015-04-27 Andre Vehreschild <vehre@gmx.de> PR fortran/59678 PR fortran/65841 * trans-array.c (duplicate_allocatable): Fixed deep copy of allocatable components, which are liable for copy only, when they are allocated. (gfc_duplicate_allocatable): Add deep-copy code into if component allocated block. Needed interface change for that. (gfc_copy_allocatable_data): Supplying NULL_TREE for code to add into if-block for checking whether a component was allocated. (gfc_duplicate_allocatable_nocopy): Likewise. (structure_alloc_comps): Likewise. * trans-array.h: Likewise. * trans-expr.c (gfc_trans_alloc_subarray_assign): Likewise. * trans-openmp.c (gfc_walk_alloc_comps): Likewise. gcc/testsuite 2015-04-27 Andre Vehreschild <vehre@gmx.de> PR fortran/59678 PR fortran/65841 * gfortran.dg/alloc_comp_deep_copy_1.f03: New test. * gfortran.dg/alloc_comp_deep_copy_2.f03: New test. From-SVN: r222477
2015-03-24re PR fortran/64787 (Invalid code on sourced allocation of class(*) ↵Andre Vehreschild1-1/+1
character string) gcc/fortran/ChangeLog 2015-03-24 Andre Vehreschild <vehre@gmx.de> PR fortran/64787 PR fortran/57456 PR fortran/63230 * class.c (gfc_add_component_ref): Free no longer needed ref-chains to prevent memory loss. (find_intrinsic_vtab): For deferred length char arrays or unlimited polymorphic objects, store the size in bytes of one character in the size component of the vtab. * gfortran.h: Added gfc_add_len_component () define. * trans-array.c (gfc_trans_create_temp_array): Switched to new function name for getting a class' vtab's field. (build_class_array_ref): Likewise. (gfc_array_init_size): Using the size information from allocate more consequently now, i.e., the typespec of the entity to allocate is no longer needed. This is to address the last open comment in PR fortran/57456. (gfc_array_allocate): Likewise. (structure_alloc_comps): gfc_copy_class_to_class () needs to know whether the class is unlimited polymorphic. * trans-array.h: Changed interface of gfc_array_allocate () to reflect the no longer needed typespec. * trans-expr.c (gfc_find_and_cut_at_last_class_ref): New. (gfc_reset_len): New. (gfc_get_class_array_ref): Switch to new function name for getting a class' vtab's field. (gfc_copy_class_to_class): Added flag to know whether the class to copy is unlimited polymorphic. Adding _len dependent code then, which calls ->vptr->copy () with four arguments adding the length information ->vptr->copy(from, to, from_len, to_cap). (gfc_conv_procedure_call): Switch to new function name for getting a class' vtab's field. (alloc_scalar_allocatable_for_assignment): Use the string_length as computed by gfc_conv_expr and not the statically backend_decl which may be incorrect when ref-ing. (gfc_trans_assignment_1): Use the string_length variable and not the rse.string_length. The former has been computed more generally. * trans-intrinsic.c (gfc_conv_intrinsic_sizeof): Switch to new function name for getting a class' vtab's field. (gfc_conv_intrinsic_storage_size): Likewise. (gfc_conv_intrinsic_transfer): Likewise. * trans-stmt.c (gfc_trans_allocate): Restructured to evaluate source=expr3 only once before the loop over the objects to allocate, when the objects are not arrays. Doing correct _len initialization and calling of vptr->copy () fixing PR 64787. (gfc_trans_deallocate): Reseting _len to 0, preventing future errors. * trans.c (gfc_build_array_ref): Switch to new function name for getting a class' vtab's field. (gfc_add_comp_finalizer_call): Likewise. * trans.h: Define the prototypes for the gfc_class_vtab_*_get () and gfc_vptr_*_get () functions. Added gfc_find_and_cut_at_last_class_ref () and gfc_reset_len () routine prototype. Added flag to gfc_copy_class_to_class () prototype to signal an unlimited polymorphic entity to copy. gcc/testsuite/ChangeLog 2015-03-24 Andre Vehreschild <vehre@gmx.de> * gfortran.dg/allocate_alloc_opt_13.f90: Added tests for source= and mold= expressions functionality. * gfortran.dg/allocate_class_4.f90: New test. * gfortran.dg/unlimited_polymorphic_20.f90: Added test whether copying an unlimited polymorhpic object containing a char array to another unlimited polymorphic object respects the _len component. * gfortran.dg/unlimited_polymorphic_22.f90: Extended to check whether deferred length char array allocate works, unlimited polymorphic object allocation from a string works and if allocating an array of deferred length strings works. * gfortran.dg/unlimited_polymorphic_24.f03: New test. From-SVN: r221621
2015-01-05Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r219188
2014-06-10re PR fortran/60928 (gfortran issue with allocatable components and OpenMP)Jakub Jelinek1-0/+4
PR fortran/60928 * omp-low.c (lower_rec_input_clauses) <case OMP_CLAUSE_LASTPRIVATE>: Set lastprivate_firstprivate even if omp_private_outer_ref langhook returns true. <case OMP_CLAUSE_REDUCTION>: When calling omp_clause_default_ctor langhook, call unshare_expr on new_var and call build_outer_var_ref to get the last argument. gcc/c-family/ * c-pragma.c (omp_pragmas_simd): Move PRAGMA_OMP_TASK... (omp_pragmas): ... back here. gcc/fortran/ * f95-lang.c (gfc_init_builtin_functions): Handle -fopenmp-simd like -fopenmp. * openmp.c (resolve_omp_clauses): Remove allocatable components diagnostics. Add associate-name and intent(in) pointer diagnostics for various clauses, diagnose procedure pointers in reduction clause. * parse.c (match_word_omp_simd): New function. (matchs, matcho): New macros. (decode_omp_directive): Change match macros to either matchs or matcho. Handle -fopenmp-simd. (next_free, next_fixed): Handle -fopenmp-simd like -fopenmp. * scanner.c (skip_free_comments, skip_fixed_comments, include_line): Likewise. * trans-array.c (get_full_array_size): Rename to... (gfc_full_array_size): ... this. No longer static. (duplicate_allocatable): Adjust caller. Add NO_MEMCPY argument and handle it. (gfc_duplicate_allocatable, gfc_copy_allocatable_data): Adjust duplicate_allocatable callers. (gfc_duplicate_allocatable_nocopy): New function. (structure_alloc_comps): Adjust g*_full_array_size and duplicate_allocatable caller. * trans-array.h (gfc_full_array_size, gfc_duplicate_allocatable_nocopy): New prototypes. * trans-common.c (create_common): Call gfc_finish_decl_attrs. * trans-decl.c (gfc_finish_decl_attrs): New function. (gfc_finish_var_decl, create_function_arglist, gfc_get_fake_result_decl): Call it. (gfc_allocate_lang_decl): If DECL_LANG_SPECIFIC is already allocated, don't allocate it again. (gfc_get_symbol_decl): Set GFC_DECL_ASSOCIATE_VAR_P on associate-names. * trans.h (gfc_finish_decl_attrs): New prototype. (struct lang_decl): Add scalar_allocatable and scalar_pointer bitfields. (GFC_DECL_SCALAR_ALLOCATABLE, GFC_DECL_SCALAR_POINTER, GFC_DECL_GET_SCALAR_ALLOCATABLE, GFC_DECL_GET_SCALAR_POINTER, GFC_DECL_ASSOCIATE_VAR_P): Define. (GFC_POINTER_TYPE_P): Remove. * trans-openmp.c (gfc_omp_privatize_by_reference): Don't check GFC_POINTER_TYPE_P, instead test GFC_DECL_GET_SCALAR_ALLOCATABLE, GFC_DECL_GET_SCALAR_POINTER or GFC_DECL_CRAY_POINTEE on decl. (gfc_omp_predetermined_sharing): Associate-names are predetermined. (enum walk_alloc_comps): New. (gfc_has_alloc_comps, gfc_omp_unshare_expr_r, gfc_omp_unshare_expr, gfc_walk_alloc_comps): New functions. (gfc_omp_private_outer_ref): Return true for scalar allocatables or decls with allocatable components. (gfc_omp_clause_default_ctor, gfc_omp_clause_copy_ctor, gfc_omp_clause_assign_op, gfc_omp_clause_dtor): Fix up handling of allocatables, handle also OMP_CLAUSE_REDUCTION, handle scalar allocatables and decls with allocatable components. (gfc_trans_omp_array_reduction_or_udr): Don't handle allocatable arrays here. (gfc_trans_omp_reduction_list): Call gfc_trans_omp_array_reduction_or_udr even for allocatable scalars. (gfc_trans_omp_do_simd): If -fno-openmp, just expand it as OMP_SIMD. (gfc_trans_omp_parallel_do_simd): Likewise. * trans-types.c (gfc_sym_type): Don't set GFC_POINTER_TYPE_P. (gfc_get_derived_type): Call gfc_finish_decl_attrs. gcc/testsuite/ * gfortran.dg/gomp/allocatable_components_1.f90: Remove dg-error directives. * gfortran.dg/gomp/associate1.f90: New test. * gfortran.dg/gomp/intentin1.f90: New test. * gfortran.dg/gomp/openmp-simd-1.f90: New test. * gfortran.dg/gomp/openmp-simd-2.f90: New test. * gfortran.dg/gomp/openmp-simd-3.f90: New test. * gfortran.dg/gomp/proc_ptr_2.f90: New test. libgomp/ * testsuite/libgomp.fortran/allocatable9.f90: New test. * testsuite/libgomp.fortran/allocatable10.f90: New test. * testsuite/libgomp.fortran/allocatable11.f90: New test. * testsuite/libgomp.fortran/allocatable12.f90: New test. * testsuite/libgomp.fortran/alloc-comp-1.f90: New test. * testsuite/libgomp.fortran/alloc-comp-2.f90: New test. * testsuite/libgomp.fortran/alloc-comp-3.f90: New test. * testsuite/libgomp.fortran/associate1.f90: New test. * testsuite/libgomp.fortran/associate2.f90: New test. * testsuite/libgomp.fortran/procptr1.f90: New test. From-SVN: r211397
2014-01-02Update copyright years in gcc/Richard Sandiford1-1/+1
From-SVN: r206289
2013-07-15trans-array.h (gfc_deallocate_alloc_comp_no_caf, [...]): New prototype.Tobias Burnus1-0/+2
2013-07-15 Tobias Burnus <burnus@net-b.de> * trans-array.h (gfc_deallocate_alloc_comp_no_caf, gfc_reassign_alloc_comp_caf): New prototype. * trans-array.c (enum): Add DEALLOCATE_ALLOC_COMP_NO_CAF and COPY_ALLOC_COMP_CAF. (structure_alloc_comps): Handle it. (gfc_reassign_alloc_comp_caf, gfc_deallocate_alloc_comp_no_caf): New function. (gfc_alloc_allocatable_for_assignment): Call it. * trans-expr.c (gfc_trans_scalar_assign, gfc_trans_arrayfunc_assign, gfc_trans_assignment_1): Ditto. * parse.c (parse_derived): Correctly set coarray_comp. * resolve.c (resolve_symbol): Improve error wording. 2013-07-15 Tobias Burnus <burnus@net-b.de> * gfortran.dg/coarray_lib_realloc_1.f90: New. * gfortran.dg/coarray/lib_realloc_1.f90: New. * gfortran.dg/coarray_6.f90: Add dg-error. From-SVN: r200955
2013-06-26re PR fortran/29800 (-fbounds-check: For derived types, write not also ↵Tobias Burnus1-1/+1
compound name) 2013-06-26 Tobias Burnus <burnus@net-b.de> PR fortran/29800 * trans-array.c (gfc_conv_array_ref): Improve out-of-bounds diagnostic message. * trans-array.c (gfc_conv_array_ref): Update prototype. * trans-expr.c (gfc_conv_variable): Update call. 2013-06-26 Tobias Burnus <burnus@net-b.de> PR fortran/29800 * gfortran.dg/bounds_check_17.f90: New. From-SVN: r200425
2013-06-04re PR fortran/37336 ([F03] Finish derived-type finalization)Tobias Burnus1-1/+1
2013-06-03 Tobias Burnus <burnus@net-b.de> PR fortran/37336 * trans.h (gfc_build_final_call): Remove prototype. (gfc_add_finalizer_call): Add prototype. * trans-array.c (gfc_trans_dealloc_allocated): Support * finalization. (structure_alloc_comps): Update caller. (gfc_trans_deferred_array): Call finalizer. * trans-array.h (gfc_trans_dealloc_allocated): Update prototype. * trans-decl.c (gfc_trans_deferred_vars): Don't * deallocate/finalize variables of the main program. * trans-expr.c (gfc_conv_procedure_call): Support finalization. * trans-openmp.c (gfc_omp_clause_dtor, gfc_trans_omp_array_reduction): Update calls. * trans-stmt.c (gfc_trans_deallocate): Avoid double deallocation of alloc components. * trans.c (gfc_add_finalizer_call): New function. (gfc_deallocate_with_status, gfc_deallocate_scalar_with_status): Call it (gfc_build_final_call): Fix handling of scalar coarrays, move up in the file and make static. 2013-06-03 Tobias Burnus <burnus@net-b.de> PR fortran/37336 * gfortran.dg/finalize_12.f90: New. * gfortran.dg/alloc_comp_basics_1.f90: Add BLOCK for end of scope finalization. * gfortran.dg/alloc_comp_constructor_1.f90: Ditto. * gfortran.dg/allocatable_scalar_9.f90: Ditto. * gfortran.dg/auto_dealloc_2.f90: Ditto. * gfortran.dg/class_19.f03: Ditto. * gfortran.dg/coarray_lib_alloc_1.f90: Ditto. * gfortran.dg/coarray_lib_alloc_2.f90: Ditto. * gfortran.dg/extends_14.f03: Ditto. * gfortran.dg/move_alloc_4.f90: Ditto. * gfortran.dg/typebound_proc_27.f03: Ditto. From-SVN: r199643
2013-05-31re PR fortran/57456 ([OOP] CLASS + CHARACTER ALLOCATE with typespec: For ↵Tobias Burnus1-1/+1
arrays, the typespec is ignored) 2013-05-31 Tobias Burnus <burnus@net-b.de> PR fortran/57456 * trans-array.c (gfc_array_init_size): Use passed type spec, when available. (gfc_array_allocate): Pass typespec on. * trans-array.h (gfc_array_allocate): Update prototype. * trans-stmt.c (gfc_trans_allocate): Pass typespec on. 2013-05-31 Tobias Burnus <burnus@net-b.de> PR fortran/57456 * gfortran.dg/class_array_17.f90: New. From-SVN: r199528
2013-01-10Update copyright years in gcc/Richard Sandiford1-2/+1
From-SVN: r195098
2013-01-04Update Copyright years for files modified in 2011 and/or 2012.Jakub Jelinek1-2/+2
From-SVN: r194903
2012-08-24re PR fortran/54350 (FAIL: gfortran.dg/realloc_on_assign_*.f90 -O ↵Tobias Burnus1-2/+2
(internal compiler error) at r190586) 2012-08-24 Tobias Burnus <burnus@net-b.de> PR fortran/54350 * trans-array.c (free_ss_info): Free data.array.subscript. (gfc_free_ss): No longer free data.array.subscript. (walk_coarray): New function, moved from trans-intrinsic.c (gfc_conv_expr_descriptor): Walk array descriptor instead of taking passed "ss". (get_array_ctor_all_strlen, gfc_add_loop_ss_code, gfc_conv_array_parameter): Update call and cleanup ss handling. * trans-array.h (gfc_conv_expr_descriptor, gfc_conv_array_parameter): Update prototype. * trans-expr.c (gfc_conv_derived_to_class, conv_isocbinding_procedure, gfc_conv_procedure_call, gfc_trans_alloc_subarray_assign, gfc_trans_subcomponent_assign, gfc_trans_pointer_assignment, gfc_trans_arrayfunc_assign): Update call to gfc_conv_expr_descriptor and gfc_conv_array_parameter, and clean up. * trans-intrinsic.c (walk_coarray): Moved to trans-array.c (trans_this_image, trans_image_index, gfc_conv_intrinsic_rank gfc_conv_intrinsic_bound, gfc_conv_intrinsic_cobound, gfc_conv_intrinsic_len, gfc_conv_intrinsic_size, gfc_conv_intrinsic_sizeof, gfc_conv_intrinsic_storage_size, gfc_conv_intrinsic_transfer, gfc_conv_allocated, gfc_conv_associated, gfc_conv_intrinsic_loc, conv_intrinsic_move_alloc): Update calls. * trans-io.c (gfc_convert_array_to_string, set_internal_unit, gfc_trans_transfer): Ditto. * trans-stmt.c (gfc_conv_elemental_dependencies, gfc_trans_sync, trans_associate_var, gfc_trans_pointer_assign_need_temp): Ditto. From-SVN: r190641
2012-08-02trans-array.h (gfc_conv_descriptor_rank): New prototype.Mikael Morin1-0/+1
* trans-array.h (gfc_conv_descriptor_rank): New prototype. * trans-array.c (gfc_conv_descriptor_rank): New function moved and renamed ... * trans-intrinsic.c (get_rank_from_desc): ... from this one. (gfc_conv_intrinsic_rank, gfc_conv_intrinsic_bound, gfc_conv_associated): Also rename function calls. From-SVN: r190095
2012-07-20re PR fortran/48820 (TR 29113: Implement parts needed for MPI 3)Tobias Burnus1-0/+1
2012-07-20 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * array.c (match_array_element_spec, gfc_match_array_spec, spec_size, gfc_array_dimen_size): Add support for assumed-rank arrays. * check.c (dim_rank_check): Ditto. * class.c (gfc_add_component_ref): Ditto. (gfc_build_class_symbol): Regard assumed-rank arrays as having GFC_MAX_DIMENSIONS. And build extra class container for a scalar pointer class. * decl.c (merge_array_spec): Add assert. * dump-parse-tree.c (show_array_spec): Add support for assumed-rank arrays. * expr.c (gfc_is_simply_contiguous): Ditto. * gfortran.h (array_type): Ditto. (gfc_array_spec, gfc_expr): Add comment to "rank" field. * interface.c (compare_type_rank, argument_rank_mismatch, compare_parameter, gfc_procedure_use): Ditto. (compare_actual_formal): Fix NULL() to optional-dummy handling for polymorphic dummies. * module.c (mio_typespec): Add support for assumed-rank arrays. * resolve.c (resolve_formal_arglist, resolve_actual_arglist, resolve_elemental_actual, resolve_global_procedure, expression_shape, resolve_variable, update_ppc_arglist, check_typebound_baseobject, gfc_resolve_expr, resolve_fl_var_and_proc, gfc_resolve_finalizers, resolve_typebound_procedure, resolve_symbol): Ditto. (assumed_type_expr_allowed): Remove static variable. (actual_arg, first_actual_arg): New static variables. * simplify.c (simplify_bound, gfc_simplify_range): Add support for assumed-rank arrays. * trans-array.c (gfc_conv_array_parameter): Ditto. (gfc_get_descriptor_dimension): New function, which returns the descriptor. (gfc_conv_descriptor_dimension): Use it. (gfc_conv_descriptor_stride_get, gfc_conv_array_parameter): Handle GFC_ARRAY_ASSUMED_RANK_CONT and AS_ASSUMED_RANK. * trans-array.h (gfc_get_descriptor_dimension): New prototype. * trans-decl. (gfc_build_dummy_array_decl, gfc_trans_deferred_vars, add_argument_checking): Add support for assumed-rank arrays. * trans-expr.c (gfc_conv_expr_present, gfc_conv_variable, gfc_conv_procedure_call): Ditto. (get_scalar_to_descriptor_type, class_array_data_assign, conv_scalar_to_descriptor): New static functions. (gfc_conv_derived_to_class, gfc_conv_class_to_class): Use them. * trans-intrinsic.c (get_rank_from_desc): New function. (gfc_conv_intrinsic_rank, gfc_conv_associated): Use it. * trans-types.c (gfc_array_descriptor_base_caf, gfc_array_descriptor_base): Make space for scalar array. (gfc_is_nodesc_array, gfc_is_nodesc_array, gfc_build_array_type, gfc_get_array_descriptor_base): Add support for assumed-rank arrays. * trans.h (gfc_array_kind): Add GFC_ARRAY_ASSUMED_RANK and GFC_ARRAY_ASSUMED_RANK_CONT. 2012-07-20 Tobias Burnus <burnus@net-b.de> PR fortran/48820 * gfortran.dg/assumed_type_3.f90: Update dg-error. * gfortran.dg/assumed_rank_1.f90: New. * gfortran.dg/assumed_rank_1_c.c: New. * gfortran.dg/assumed_rank_2.f90: New. * gfortran.dg/assumed_rank_4.f90: New. * gfortran.dg/assumed_rank_5.f90: New. * gfortran.dg/assumed_rank_6.f90: New. * gfortran.dg/assumed_rank_7.f90: New. * gfortran.dg/assumed_rank_8.f90: New. * gfortran.dg/assumed_rank_8_c.c: New. * gfortran.dg/assumed_rank_9.f90: New. * gfortran.dg/assumed_rank_10.f90: New. * gfortran.dg/assumed_rank_12.f90: New. From-SVN: r189700
2012-02-12trans-array.c (gfc_walk_elemental_function_args, [...]): Move call to ↵Mikael Morin1-1/+3
gfc_get_proc_ifc_for_expr out of gfc_walk_elemental_function_args. * trans-array.c (gfc_walk_elemental_function_args, gfc_walk_function_expr): Move call to gfc_get_proc_ifc_for_expr out of gfc_walk_elemental_function_args. * trans-stmt.c (gfc_trans_call): Ditto. * trans-array.h (gfc_get_proc_ifc_for_expr): New prototype. (gfc_walk_elemental_function_args): Update prototype. From-SVN: r184141
2012-01-27re PR fortran/48705 ([OOP] ALLOCATE with non-trivial SOURCE)Paul Thomas1-1/+1
2012-01-27 Paul Thomas <pault@gcc.gnu.org> Tobias Burnus <burnus@gcc.gnu.org> PR fortran/48705 PR fortran/51870 PR fortran/51943 PR fortran/51946 * trans-array.c (gfc_array_init_size): Add two extra arguments to convey the dynamic element size of a calls object and to return the number of elements that have been allocated. (gfc_array_allocate): Add the same arguments and use them to call gfc_array_init_size. Before the allocation dereference the data pointer, if necessary. Set the allocated array to zero if the class element size or expr3 are non-null. * trans-expr.c (gfc_conv_class_to_class): Give this function global scope. (get_class_array_ref): New function. (gfc_copy_class_to_class): New function. * trans-array.h : Update prototype for gfc_array_allocate. * trans-stmt.c (gfc_trans_allocate): For non-variable class STATUS expressions extract the class object and the dynamic element size. Use the latter to call gfc_array_allocate and the former for setting the vptr and, via gfc_copy_class_to_clasfc_cs, to copy to the allocated data. * trans.h : Prototypes for gfc_get_class_array_ref, gfc_copy_class_to_class and gfc_conv_class_to_class. 2012-01-27 Paul Thomas <pault@gcc.gnu.org> Tobias Burnus <burnus@gcc.gnu.org> PR fortran/48705 * gfortran.dg/class_allocate_11.f03: New. PR fortran/51870 PR fortran/51943 PR fortran/51946 * gfortran.dg/class_allocate_7.f03: New. * gfortran.dg/class_allocate_8.f03: New. * gfortran.dg/class_allocate_9.f03: New. * gfortran.dg/class_allocate_10.f03: New. Co-Authored-By: Tobias Burnus <burnus@gcc.gnu.org> From-SVN: r183613
2012-01-062012-01-06 Tobias Burnus <burnus@net-b.de>Tobias Burnus1-4/+5
* trans-openmp.c (gfc_omp_clause_dtor, * gfc_trans_omp_array_reduction): Update call to gfc_trans_dealloc_allocated. * trans.c (gfc_allocate_using_malloc): Fix spacing. (gfc_allocate_allocatable): For gfc_allocate_using_lib, jump to label_finish when an error occurs. (gfc_deallocate_with_status): Call caf_deregister for -fcoarray=lib. * trans.h (gfc_allocate_allocatable, * gfc_deallocate_with_status): Update prototype. (gfor_fndecl_caf_deregister): New tree symbol. * trans-expr.c (gfc_conv_procedure_call): Update gfc_deallocate_with_status and gfc_trans_dealloc_allocated calls. * trans-array.c (gfc_array_allocate, * gfc_trans_dealloc_allocated, structure_alloc_comps, gfc_trans_deferred_array): Ditto. (gfc_array_deallocate): Handle coarrays with -fcoarray=lib. * trans-array.h (gfc_array_deallocate, gfc_array_allocate, gfc_trans_dealloc_allocated): Update prototypes. * trans-stmt.c (gfc_trans_sync): Fix indentation. (gfc_trans_allocate): Fix errmsg padding and label handling. (gfc_trans_deallocate): Ditto and handle -fcoarray=lib. * expr.c (gfc_is_coarray): Fix algorithm for BT_CLASS. * libgfortran.h (GFC_STAT_STOPPED_IMAGE): Use large value to avoid other stats accidentally matching this one. * trans-decl.c (gfor_fndecl_caf_deregister): New global var. (gfc_build_builtin_function_decls): Fix prototype decl of caf_register and add decl for caf_deregister. (gfc_trans_deferred_vars): Handle CAF vars with -fcoarrays=lib. * trans-intrinsic.c (conv_intrinsic_move_alloc): Update call to gfc_deallocate_with_status. 2012-01-06 Tobias Burnus <burnus@net-b.de> * caf/single.c (_gfortran_caf_register, * _gfortran_caf_deregister): Fix token handling. * caf/mpi.c (_gfortran_caf_register, _gfortran_caf_deregister): * Ditto. * caf/libcaf.h (STAT_STOPPED_IMAGE): Sync with libgfortran.h. (_gfortran_caf_register, _gfortran_caf_deregister): Update prototype. 2012-01-06 Tobias Burnus <burnus@net-b.de> * gfortran.dg/deallocate_stat_2.f90: New. * coarray/allocate_errgmsg.f90: New. * gfortran.dg/coarray_lib_alloc_1.f90: New. * gfortran.dg/coarray_lib_alloc_2.f90: New. * coarray/subobject_1.f90: Fix for num_images > 1. * gfortran.dg/deallocate_stat.f90: Update due to changed stat= handling. From-SVN: r182951
2012-01-04re PR fortran/50981 ([OOP] Wrong-code for scalarizing ELEMENTAL call with ↵Mikael Morin1-1/+1
absent OPTIONAL argument) PR fortran/50981 * trans-array.h (gfc_walk_elemental_function_args): New argument. * trans-intrinsic.c (gfc_walk_intrinsic_function): Update call. * trans-stmt.c (gfc_trans_call): Ditto. * trans-array.c (gfc_walk_function_expr): Ditto. (gfc_walk_elemental_function_args): Get the dummy argument list if possible. Check that the dummy and the actual argument are both optional, and set can_be_null_ref accordingly. * gfortran.dg/elemental_optional_args_2.f90: New test. From-SVN: r182875
2011-12-11re PR fortran/41539 ([OOP] Calling function which takes CLASS: Rank ↵Paul Thomas1-2/+2
comparison does not work) 2011-12-11 Paul Thomas <pault@gcc.gnu.org> Tobias Burnus <burnus@gcc.gnu.org> PR fortran/41539 PR fortran/43214 PR fortran/43969 PR fortran/44568 PR fortran/46356 PR fortran/46990 PR fortran/49074 * interface.c(symbol_rank): Return the rank of the _data component of class objects. (compare_parameter): Also compare the derived type of the class _data component for type mismatch. Similarly, return 1 if the formal and _data ranks match. (compare_actual_formal): Do not compare storage sizes for class expressions. It is an error if an actual class array, passed to a formal class array is not full. * trans-expr.c (gfc_class_data_get, gfc_class_vptr_get, gfc_vtable_field_get, gfc_vtable_hash_get, gfc_vtable_size_get, gfc_vtable_extends_get, gfc_vtable_def_init_get, gfc_vtable_copy_get): New functions for class API. (gfc_conv_derived_to_class): For an array reference in an elemental procedure call retain the ss to provide the scalarized array reference. Moved in file. (gfc_conv_class_to_class): New function. (gfc_conv_subref_array_arg): Use the type of the class _data component as a basetype. (gfc_conv_procedure_call): Ensure that class array expressions have both the _data reference and an array reference. Use gfc_conv_class_to_class to handle class arrays for elemental functions in scalarized loops, class array elements and full class arrays. Use a call to gfc_conv_subref_array_arg in order that the copy-in/copy-out for passing class arrays to derived type arrays occurs correctly. (gfc_conv_expr): If it is missing, add the _data component between a class object or component and an array reference. (gfc_trans_class_array_init_assign): New function. (gfc_trans_class_init_assign): Call it for array expressions. * trans-array.c (gfc_add_loop_ss_code): Do not use a temp for class scalars since their size will depend on the dynamic type. (build_class_array_ref): New function. (gfc_conv_scalarized_array_ref): Call build_class_array_ref. (gfc_array_init_size): Add extra argument, expr3, that represents the SOURCE argument. If present,use this for the element size. (gfc_array_allocate): Also add argument expr3 and use it when calling gfc_array_init_size. (structure_alloc_comps): Enable class arrays. * class.c (gfc_add_component_ref): Carry over the derived type of the _data component. (gfc_add_class_array_ref): New function. (class_array_ref_detected): New static function. (gfc_is_class_array_ref): New function that calls previous. (gfc_is_class_scalar_expr): New function. (gfc_build_class_symbol): Throw not implemented error for assumed size class arrays. Remove error that prevents CLASS arrays. (gfc_build_class_symbol): Prevent pointer/allocatable conflict. Also unset codimension. (gfc_find_derived_vtab): Make 'copy' elemental and set the intent of the arguments accordingly.: * trans-array.h : Update prototype for gfc_array_allocate. * array.c (gfc_array_dimen_size): Return failure if class expr. (gfc_array_size): Likewise. * gfortran.h : New prototypes for gfc_add_class_array_ref, gfc_is_class_array_ref and gfc_is_class_scalar_expr. * trans-stmt.c (trans_associate_var): Exclude class targets from test. Move the allocation of the _vptr to an earlier time for class objects. (trans_associate_var): Assign the descriptor directly for class arrays. (gfc_trans_allocate): Add expr3 to gfc_array_allocate arguments. Convert array element references into sections. Do not invoke gfc_conv_procedure_call, use gfc_trans_call instead. * expr.c (gfc_get_corank): Fix for BT_CLASS. (gfc_is_simply_contiguous): Exclude class from test. * trans.c (gfc_build_array_ref): Include class array refs. * trans.h : Include prototypes for class API functions that are new in trans-expr. Define GFC_DECL_CLASS(node). * resolve.c (check_typebound_baseobject ): Remove error for non-scalar base object. (resolve_allocate_expr): Ensure that class _data component is present. If array, call gfc_expr_to_intialize. (resolve_select): Remove scalar error for SELECT statement as a temporary measure. (resolve_assoc_var): Update 'target' (aka 'selector') as needed. Ensure that the target expression has the right rank. (resolve_select_type): Ensure that target expressions have a valid locus. (resolve_allocate_expr, resolve_fl_derived0): Fix for BT_CLASS. * trans-decl.c (gfc_get_symbol_decl): Set GFC_DECL_CLASS, where appropriate. (gfc_trans_deferred_vars): Get class arrays right. * match.c(select_type_set_tmp): Add array spec to temporary. (gfc_match_select_type): Allow class arrays. * check.c (array_check): Ensure that class arrays have refs. (dim_corank_check, dim_rank_check): Retrun success if class. * primary.c (gfc_match_varspec): Fix for class arrays and co-arrays. Make sure that class _data is present. (gfc_match_rvalue): Handle class arrays. *trans-intrinsic.c (gfc_conv_intrinsic_size): Add class array reference. (gfc_conv_allocated): Add _data component to class expressions. (gfc_add_intrinsic_ss_code): ditto. * simplify.c (simplify_cobound): Fix for BT_CLASS. (simplify_bound): Return NULL for class arrays. (simplify_cobound): Obtain correct array_spec. Use cotype as appropriate. Use arrayspec for bounds. 2011-12-11 Paul Thomas <pault@gcc.gnu.org> Tobias Burnus <burnus@gcc.gnu.org> PR fortran/41539 PR fortran/43214 PR fortran/43969 PR fortran/44568 PR fortran/46356 PR fortran/46990 PR fortran/49074 * gfortran.dg/class_array_1.f03: New. * gfortran.dg/class_array_2.f03: New. * gfortran.dg/class_array_3.f03: New. * gfortran.dg/class_array_4.f03: New. * gfortran.dg/class_array_5.f03: New. * gfortran.dg/class_array_6.f03: New. * gfortran.dg/class_array_7.f03: New. * gfortran.dg/class_array_8.f03: New. * gfortran.dg/coarray_poly_1.f90: New. * gfortran.dg/coarray_poly_2.f90: New. * gfortran.dg/coarray/poly_run_1.f90: New. * gfortran.dg/coarray/poly_run_2.f90: New. * gfortran.dg/class_to_type_1.f03: New. * gfortran.dg/type_to_class_1.f03: New. * gfortran.dg/typebound_assignment_3.f03: Remove the error. * gfortran.dg/auto_dealloc_2.f90: Occurences of __builtin_free now 2. * gfortran.dg/class_19.f03: Occurences of __builtin_free now 8. Co-Authored-By: Tobias Burnus <burnus@gcc.gnu.org> From-SVN: r182210
2011-11-04trans-array.h (gfc_free_ss, [...]): New prototypes.Mikael Morin1-0/+4
* trans-array.h (gfc_free_ss, gfc_set_delta): New prototypes. * trans-array.c (gfc_free_ss): Remove forward declaration. Make non-static. (set_delta, gfc_set_delta): Remove forward declaration. Make non-static and rename the former to the later. Update uses. From-SVN: r180905
2011-11-03trans-array.h (gfc_trans_create_temp_array): Remove loop argument.Mikael Morin1-3/+2
* trans-array.h (gfc_trans_create_temp_array): Remove loop argument. * trans-array.c (gfc_trans_create_temp_array): Ditto. Get loop from ss. Update reference to loop. Remove loop argument. (gfc_trans_array_constructor, gfc_conv_loop_setup): Update calls to gfc_trans_create_temp_array. * trans-expr.c (gfc_conv_procedure_call): Ditto. * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ditto. * trans-stmt.c (gfc_conv_elemental_dependencies): Ditto. Set loop before calling gfc_trans_create_temp_array. From-SVN: r180888
2011-11-03trans-array.h (gfc_trans_create_temp_array): Replace info argument with ss ↵Mikael Morin1-1/+1
argument. * trans-array.h (gfc_trans_create_temp_array): Replace info argument with ss argument. * trans-array.c (gfc_trans_create_temp_array): Ditto. Get info from ss. (gfc_trans_array_constructor, gfc_conv_loop_setup): Update call to gfc_trans_create_temp_array. * trans-expr.c (gfc_conv_procedure_call): Ditto. * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Ditto. * trans-stmt.c (gfc_conv_elemental_dependencies): Ditto. From-SVN: r180859
2011-10-18trans-array.h (gfc_walk_array_ref): New prototype.Mikael Morin1-0/+2
* trans-array.h (gfc_walk_array_ref): New prototype. * trans-array.c (gfc_walk_array_ref): New function, containing all but the beginning of gfc_walk_variable_expr's code. (gfc_walk_variable_expr): Use gfc_walk_array_ref. From-SVN: r180144
2011-09-08trans-array.h (gfc_get_scalar_ss): New prototype.Mikael Morin1-0/+2
2011-09-08 Mikael Morin <mikael.morin@sfr.fr> * trans-array.h (gfc_get_scalar_ss): New prototype. * trans-array.c (gfc_get_scalar_ss): New function. (gfc_walk_variable_expr, gfc_walk_op_expr, gfc_walk_elemental_function_args): Re-use gfc_get_scalar_ss. * trans-expr.c (gfc_trans_subarray_assign): Ditto. (gfc_trans_assignment_1): Ditto. * trans-stmt.c (compute_inner_temp_size, gfc_trans_where_assign, gfc_trans_where_3): Ditto. From-SVN: r178697
2011-09-08trans-array.h (gfc_get_temp_ss): New prototype.Mikael Morin1-0/+2
2011-09-08 Mikael Morin <mikael.morin@sfr.fr> * trans-array.h (gfc_get_temp_ss): New prototype. * trans-array.c (gfc_get_temp_ss): New function. (gfc_conv_resolve_dependencies): Re-use gfc_get_temp_ss. (gfc_conv_expr_descriptor): Ditto. * trans-expr.c (gfc_conv_subref_array_arg): Ditto. From-SVN: r178696
2011-09-08trans-array.h (gfc_get_array_ss): New prototype.Mikael Morin1-0/+2
2011-09-08 Mikael Morin <mikael.morin@sfr.fr> * trans-array.h (gfc_get_array_ss): New prototype. * trans-array.c (gfc_get_array_ss): New function. (gfc_walk_variable_expr, gfc_walk_function_expr, gfc_walk_array_constructor): Re-use gfc_get_array_ss. * trans-expr.c (gfc_trans_subarray_assign): Ditto. * trans-intrinsic.c (gfc_walk_intrinsic_bound, gfc_walk_intrinsic_libfunc): Ditto. * trans-io.c (transfer_array_component): Ditto. From-SVN: r178695
2011-07-26trans-array.c (CAF_TOKEN_FIELD): New macro constant.Tobias Burnus1-0/+1
2011-07-26 Tobias Burnus <burnus@net-b.de> * trans-array.c (CAF_TOKEN_FIELD): New macro constant. (gfc_conv_descriptor_token): New function. * trans-array.h (gfc_conv_descriptor_token): New prototype. * trans-types.c (gfc_get_array_descriptor_base): For coarrays with -fcoarray=lib, append "void *token" to the array descriptor. (gfc_array_descriptor_base_caf): New static variable. * trans-expr.c (gfc_conv_procedure_call): Handle token and * offset when passing a descriptor coarray to a nondescriptor dummy. 2011-07-26 Tobias Burnus <burnus@net-b.de> * gfortran.dg/coarray_lib_token_2.f90: New. From-SVN: r176784
2011-07-21trans.c (gfc_allocate_with_status): Split into two functions ↵Daniel Carrera1-1/+1
gfc_allocate_using_malloc and gfc_allocate_usig_lib. 2011-07-21 Daniel Carrera <dcarrera@gmail.com> * trans.c (gfc_allocate_with_status): Split into two functions gfc_allocate_using_malloc and gfc_allocate_usig_lib. (gfc_allocate_using_malloc): The status parameter is now the actual status rather than a pointer. Code cleanup. (gfc_allocate_using_lib): Ditto. Add new parametrs errmsg and errlen. Pass these to the coarray lib. * trans-openmp.c (gfc_omp_clause_default_ctor): Update calls to gfc_allocate_allocatable. (gfc_omp_clause_copy_ctor): Ditto. (gfc_trans_omp_array_reduction): Ditto. * trans-stmt.c (gfc_trans_allocate): Ditto. Update call to gfc_allocate_using_malloc. Pass stat rather than pstat to the allocate fuctions. If using coarray lib, pass errmsg and errlen to the allocate functions. Move error checking outside the if (!gfc_array_allocate) block so that it also affects trees produced by gfc_array_allocate. * trans-array.c (gfc_array_allocate): Add new parameters errmsg and errlen. Replace parameter pstat by status. Code cleanup. Update calls to gfc_allocate_allocatable and gfc_allocate_using_malloc. * trans-array.h (gfc_array_allocate): Update signature of gfc_array_allocate. From-SVN: r176606
2011-05-31re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])Tobias Burnus1-0/+3
2011-05-31 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * resolve.c (resolve_fl_variable): Handle static coarrays with non-constant cobounds. (resolve_symbol): Handle SAVE statement without arguments for coarrays. * trans-array.c (gfc_trans_array_cobounds): New function. (gfc_trans_array_bounds): Place code by call to it. * trans-array.h (gfc_trans_array_cobounds): New prototype. * trans-decl.c (gfc_get_symbol_decl, gfc_trans_deferred_vars): Handle static coarrays with nonconstant cobounds. 2011-05-31 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * gfortran.dg/coarray/save_1.f90: New. * gfortran.dg/coarray_4.f90: Update dg-error. From-SVN: r174503
2011-04-11re PR fortran/18918 (Eventually support Fortran 2008's coarrays [co-arrays])Tobias Burnus1-0/+1
2011-04-11 Tobias Burnus <burnus@net-b.de> PR fortran/18918 * simplify.c (simplify_bound_dim): Exit for ucobound's last dimension unless -fcoarray=single. * trans-array (gfc_conv_descriptor_size_1): Renamed from gfc_conv_descriptor_size, made static, has now from_dim and to_dim arguments. (gfc_conv_descriptor_size): Call gfc_conv_descriptor_size. (gfc_conv_descriptor_cosize): New function. * trans-array.h (gfc_conv_descriptor_cosize): New prototype. * trans-intrinsic.c (conv_intrinsic_cobound): Add input_location and handle last codim of ucobound for when -fcoarray is not "single". From-SVN: r172262
2010-11-28re PR fortran/35810 ([TR 15581 / F2003] Automatic reallocation on assignment ↵Paul Thomas1-0/+4
to allocatable variables) 2010-11-28 Paul Thomas <pault@gcc.gnu.org> PR fortran/35810 * trans-array.c (gfc_trans_array_constructor): If the loop->to is a VAR_DECL, assume this is dynamic. In this case, use the counter to obtain the value and set loop->to appropriately. (gfc_conv_ss_descriptor): Always save the offset of a variable in info.saved_offset. (gfc_conv_ss_startstride): Do not attempt bound checking of the lhs of an assignment, if allocatable and f2003 is allowed. (gfc_conv_loop_setup): If possible, do not use an allocatable lhs variable for the loopspec. (gfc_is_reallocatable_lhs): New function. (get_std_lbound): New function. (gfc_alloc_allocatable_for_assignment): New function. * gfortran.h : Add flag_realloc_lhs to the options structure. * lang.opt : Add option f(no-)realloc-lhs. * invoke.texi : Document option f(no-)realloc-lhs. * options.c (gfc_init_options, gfc_post_options, gfc_handle_option): Incorporate f(no-)realloc-lhs with default to frealloc_lhs for -std > f95. * trans-array.h : Add primitive for previous. * trans-expr.c (gfc_conv_string_length): Return if character length is a variable and the expression is NULL. (gfc_conv_procedure_call): If the call is of the kind x = f(...) and the lhs is allocatable and reallocation on assignment OK, call gfc_alloc_allocatable_for_assignment. Do not generate the function call unless direct by reference. (realloc_lhs_loop_for_fcn_call): New function. (realloc_lhs_bounds_for_intrinsic_call): New function. (gfc_trans_arrayfunc_assign): Reallocation assignments need a loopinfo and for the loop bounds to be set. With intrinsic functions, free the lhs data and let the library allocate the data array. Done by the new functions above. (gfc_trans_assignment_1): If the lhs is allocatable and reallocation on assignment is allowed, mark the lhs and use gfc_alloc_allocatable_for_assignment to make the reallocation. * trans.h : Add is_alloc_lhs bitfield to gfc_ss structure. 2010-11-28 Paul Thomas <pault@gcc.gnu.org PR fortran/35810 * gfortran.dg/realloc_on_assign_1.f03: New test. * gfortran.dg/realloc_on_assign_2.f03: New test. * gfortran.dg/transpose_2.f90: dg-option -fno-realloc-lhs. * gfortran.dg/unpack_bounds_1.f90: The same. * gfortran.dg/cshift_bounds_2.f90: The same. * gfortran.dg/matmul_bounds_2.f90: The same. * gfortran.dg/matmul_bounds_3.f90: The same. * gfortran.dg/matmul_bounds_4.f90: The same. * gfortran.dg/matmul_bounds_5.f90: The same. From-SVN: r167220
2010-10-06trans-array.c (gfc_free_ss_chain): Made non-static.Mikael Morin1-0/+2
2010-10-06 Mikael Morin <mikael@gcc.gnu.org> * trans-array.c (gfc_free_ss_chain): Made non-static. * trans-array.h (gfc_free_ss_chain): New prototype. * trans-stmt.c (gfc_trans_where_2): Free ss chains. From-SVN: r165052