aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-expr.c
AgeCommit message (Collapse)AuthorFilesLines
2019-06-08re PR fortran/90786 (ICE on procedure pointer assignment to function with ↵Paul Thomas1-22/+7
class pointer result) 2019-06-08 Paul Thomas <pault@gcc.gnu.org> PR fortran/90786 * trans-expr.c (pointer_assignment_is_proc_pointer) Remove as it is very simple and only called from one place. (gfc_trans_pointer_assignment): Rename non_proc_pointer_assign as non_proc_ptr_assign. Assign to it directly, rather than call to above, deleted function and use gfc_expr_attr instead of only checking the reference chain. 2019-06-08 Paul Thomas <pault@gcc.gnu.org> PR fortran/90786 * gfortran.dg/proc_ptr_51.f90 : New test. From-SVN: r272084
2019-06-02re PR fortran/90539 (481.wrf slowdown by 25% on Intel Kaby with -Ofast ↵Thomas Koenig1-12/+41
-march=native starting with r271377) 2019-06-02 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/90539 * trans-expr.c (gfc_conv_subref_array_arg): If the size of the expression can be determined to be one, treat it as contiguous. Set likelyhood of presence of an actual argument according to PRED_FORTRAN_ABSENT_DUMMY and likelyhood of being contiguous according to PRED_FORTRAN_CONTIGUOUS. 2019-06-02 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/90539 * predict.def (PRED_FORTRAN_CONTIGUOUS): New predictor. 2019-06-02 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/90539 * gfortran.dg/internal_pack_24.f90: New test. From-SVN: r271844
2019-05-29re PR fortran/90539 (481.wrf slowdown by 25% on Intel Kaby with -Ofast ↵Thomas Koenig1-32/+118
-march=native starting with r271377) 2019-05-29 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/90539 * gfortran.h (gfc_has_dimen_vector_ref): Add prototype. * trans.h (gfc_conv_subref_array_arg): Add argument check_contiguous. (gfc_conv_is_contiguous_expr): Add prototype. * frontend-passes.c (has_dimen_vector_ref): Remove prototype, rename to (gfc_has_dimen_vector_ref): New function name. (matmul_temp_args): Use gfc_has_dimen_vector_ref. (inline_matmul_assign): Likewise. * trans-array.c (gfc_conv_array_parameter): Also check for absence of a vector subscript before calling gfc_conv_subref_array_arg. Pass additional argument to gfc_conv_subref_array_arg. * trans-expr.c (gfc_conv_subref_array_arg): Add argument check_contiguous. If that is true, check if the argument is contiguous and do not repack in that case. * trans-intrinsic.c (gfc_conv_intrinsic_is_contiguous): Split away most of the work into, and call (gfc_conv_intrinsic_is_coniguous_expr): New function. 2019-05-29 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/90539 * gfortran.dg/internal_pack_21.f90: Adjust scan patterns. * gfortran.dg/internal_pack_22.f90: New test. * gfortran.dg/internal_pack_23.f90: New test. From-SVN: r271751
2019-05-19re PR fortran/88821 (Inline packing of non-contiguous arguments)Thomas Koenig1-2/+81
2019-05-19 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/88821 * expr.c (gfc_is_simply_contiguous): Return true for an EXPR_ARRAY. * trans-array.c (is_pointer): New function. (gfc_conv_array_parameter): Call gfc_conv_subref_array_arg when not optimizing and not optimizing for size if the formal arg is passed by reference. * trans-expr.c (gfc_conv_subref_array_arg): Add arguments fsym, proc_name and sym. Add run-time warning for temporary array creation. Wrap argument if passing on an optional argument to an optional argument. * trans.h (gfc_conv_subref_array_arg): Add optional arguments fsym, proc_name and sym to prototype. 2019-05-19 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/88821 * gfortran.dg/alloc_comp_auto_array_3.f90: Add -O0 to dg-options to make sure the test for internal_pack is retained. * gfortran.dg/assumed_type_2.f90: Split compile and run time tests into this and * gfortran.dg/assumed_type_2a.f90: New file. * gfortran.dg/c_loc_test_22.f90: Likewise. * gfortran.dg/contiguous_3.f90: Likewise. * gfortran.dg/internal_pack_11.f90: Likewise. * gfortran.dg/internal_pack_12.f90: Likewise. * gfortran.dg/internal_pack_16.f90: Likewise. * gfortran.dg/internal_pack_17.f90: Likewise. * gfortran.dg/internal_pack_18.f90: Likewise. * gfortran.dg/internal_pack_4.f90: Likewise. * gfortran.dg/internal_pack_5.f90: Add -O0 to dg-options to make sure the test for internal_pack is retained. * gfortran.dg/internal_pack_6.f90: Split compile and run time tests into this and * gfortran.dg/internal_pack_6a.f90: New file. * gfortran.dg/internal_pack_8.f90: Likewise. * gfortran.dg/missing_optional_dummy_6: Split compile and run time tests into this and * gfortran.dg/missing_optional_dummy_6a.f90: New file. * gfortran.dg/no_arg_check_2.f90: Split compile and run time tests into this and * gfortran.dg/no_arg_check_2a.f90: New file. * gfortran.dg/typebound_assignment_5.f90: Split compile and run time tests into this and * gfortran.dg/typebound_assignment_5a.f90: New file. * gfortran.dg/typebound_assignment_6.f90: Split compile and run time tests into this and * gfortran.dg/typebound_assignment_6a.f90: New file. * gfortran.dg/internal_pack_19.f90: New file. * gfortran.dg/internal_pack_20.f90: New file. * gfortran.dg/internal_pack_21.f90: New file. From-SVN: r271377
2019-05-10re PR fortran/90093 (Extended C interop: optional argument incorrectly ↵Paul Thomas1-0/+1
identified as PRESENT) 2019-05-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/90093 * trans-decl.c (convert_CFI_desc): Test that the dummy is present before doing any of the conversions. PR fortran/90352 * decl.c (gfc_verify_c_interop_param): Restore the error for charlen > 1 actual arguments passed to bind(C) procs. Clean up trailing white space. PR fortran/90355 * trans-array.c (gfc_trans_create_temp_array): Set the 'span' field to the element length for all types. (gfc_conv_expr_descriptor): The force_no_tmp flag is used to prevent temporary creation, especially for substrings. * trans-decl.c (gfc_trans_deferred_vars): Rather than assert that the backend decl for the string length is non-null, use it as a condition before calling gfc_trans_vla_type_sizes. * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): 'force_no_tmp' is set before calling gfc_conv_expr_descriptor. * trans.c (get_array_span): Move the code for extracting 'span' from gfc_build_array_ref to this function. This is specific to descriptors that are component and indirect references. * trans.h : Add the force_no_tmp flag bitfield to gfc_se. 2019-05-10 Paul Thomas <pault@gcc.gnu.org> PR fortran/90093 * gfortran.dg/ISO_Fortran_binding_12.f90: New test. * gfortran.dg/ISO_Fortran_binding_12.c: Supplementary code. PR fortran/90352 * gfortran.dg/iso_c_binding_char_1.f90: New test. PR fortran/90355 * gfortran.dg/ISO_Fortran_binding_4.f90: Add 'substr' to test the direct passing of substrings as descriptors to bind(C). * gfortran.dg/assign_10.f90: Increase the tree_dump count of 'atmp' to account for the setting of the 'span' field. * gfortran.dg/transpose_optimization_2.f90: Ditto. From-SVN: r271057
2019-04-14re PR fortran/89843 (CFI_section delivers incorrect result descriptor)Paul Thomas1-77/+18
2019-04-14 Paul Thomas <pault@gcc.gnu.org> PR fortran/89843 * trans-decl.c (gfc_get_symbol_decl): Assumed shape and assumed rank dummies of bind C procs require deferred initialization. (convert_CFI_desc): New procedure to convert incoming CFI descriptors to gfc types and back again. (gfc_trans_deferred_vars): Call it. * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Null the CFI descriptor pointer. Free the descriptor in all cases. PR fortran/89846 * expr.c (is_CFI_desc): New function. (is_subref_array): Tidy up by referencing the symbol directly. * gfortran.h : Prototype for is_CFI_desc. * trans_array.c (get_CFI_desc): New function. (gfc_get_array_span, gfc_conv_scalarized_array_ref, gfc_conv_array_ref): Use it. * trans.c (get_array_span): Extract the span from descriptors that are indirect references. PR fortran/90022 * trans-decl.c (gfc_get_symbol_decl): Make sure that the se expression is a pointer type before converting it to the symbol backend_decl type. * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Eliminate temporary creation for intent(in). 2019-04-14 Paul Thomas <pault@gcc.gnu.org> PR fortran/89843 * gfortran.dg/ISO_Fortran_binding_4.f90: Modify the value of x in ctg. Test the conversion of the descriptor types in the main program. * gfortran.dg/ISO_Fortran_binding_10.f90: New test. * gfortran.dg/ISO_Fortran_binding_10.c: Called by it. PR fortran/89846 * gfortran.dg/ISO_Fortran_binding_11.f90: New test. * gfortran.dg/ISO_Fortran_binding_11.c: Called by it. PR fortran/90022 * gfortran.dg/ISO_Fortran_binding_1.c: Correct the indexing for the computation of 'ans'. Also, change the expected results for CFI_is_contiguous to comply with standard. * gfortran.dg/ISO_Fortran_binding_1.f90: Correct the expected results for CFI_is_contiguous to comply with standard. * gfortran.dg/ISO_Fortran_binding_9.f90: New test. * gfortran.dg/ISO_Fortran_binding_9.c: Called by it. 2019-04-14 Paul Thomas <pault@gcc.gnu.org> PR fortran/89843 * runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Only return immediately if the source pointer is null. Bring forward the extraction of the gfc type. Extract the kind so that the element size can be correctly computed for sections and components of derived type arrays. Remove the free of the CFI descriptor since this is now done in trans-expr.c. (gfc_desc_to_cfi_desc): Only allocate the CFI descriptor if it is not null. (CFI_section): Normalise the difference between the upper and lower bounds by the stride to correctly calculate the extents of the section. PR fortran/89846 * runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc): Use the stride measure for the gfc span if it is not a multiple of the element length. Otherwise use the element length. PR fortran/90022 * runtime/ISO_Fortran_binding.c (CFI_is_contiguous) : Return 1 for true and 0 otherwise to comply with the standard. Correct the contiguity check for rank 3 and greater by using the stride measure of the lower dimension rather than the element length. From-SVN: r270353
2019-03-30re PR fortran/89841 (improper descriptor information passed to C)Paul Thomas1-3/+2
2019-03-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/89841 * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Use the formal argument attributes rather than those of the actual argument. PR fortran/89842 * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Call 'set_dtype_for_unallocated' for any type of arrayspec. 2019-03-30 Paul Thomas <pault@gcc.gnu.org> PR fortran/89841 * gfortran.dg/ISO_Fortran_binding_1.f90: Change the interfaces for c_deallocate, c_allocate and c_assumed_size so that the attributes of the array arguments are correct and are typed. * gfortran.dg/ISO_Fortran_binding_7.f90: New test. * gfortran.dg/ISO_Fortran_binding_7.c: Additional source. PR fortran/89842 * gfortran.dg/ISO_Fortran_binding_8.f90: New test. * gfortran.dg/ISO_Fortran_binding_8.c: Additional source. From-SVN: r270037
2019-03-27re PR fortran/88247 (ICE in get_array_ctor_var_strlen, at ↵Paul Thomas1-2/+14
fortran/trans-array.c:2068) 2019-03-27 Paul Thomas <pault@gcc.gnu.org> PR fortran/88247 * expr.c (is_subref_array): Permit substrings to be detected as subref arrays. * trans-array.c (get_array_ctor_var_strlen): Obtain the length of deferred length strings. Handle substrings with a NULL end expression. (trans_array_constructor): Remove an unnecessary blank line. (gfc_conv_scalarized_array_ref): Skip to label 'done' if 'decl' is a pointer array. (get_array_charlen): If the expression is an array, convert the first element of the constructor and use its string length. Get a new charlen if necessary. (gfc_conv_expr_descriptor): Call 'get_array_charlen' for array constructor expressions. If the ss_info string length is available, use that to set the span of character arrays. * trans-expr.c (gfc_get_expr_charlen): Handle substrings * trans-stmt.c (trans_associate_var): Set the pointer array flag for variable targets and constant array constructors. Take care not to reset the string length or the span in the case of expressions that are not converted as direct by reference. 2019-03-27 Paul Thomas <pault@gcc.gnu.org> PR fortran/88247 * gfortran.dg/associate_47.f90: New test. From-SVN: r269962
2019-03-18re PR fortran/88008 (ICE in check_typebound_baseobject, at ↵Thomas Koenig1-0/+1
fortran/resolve.c:6058) 2019-03-17 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/88008 * gfortran.h (expr_t): Add EXPR_UNKNOWN. * expr.c (gfc_copy_expr): Add EXPR_UNKNOWN to switch statement. (gfc_simplify_expr): Likewise. * module.c (mio_expr): Likewise. * resovle.c (extract_compcall_passed_object): Issue error on unknown type. (check_typebound_baseobject): Issue error on wrong type. * trans-expr.c (gfc_apply_interface_mapping_to_expr): Add EXPR_UNKNOWN to switch statement. 2019-03-17 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/88008 * gfortran.dg/typebound_call_31.f90: New test. From-SVN: r269750
2019-03-13re PR fortran/87045 (pointer to array of character)Harald Anlauf1-10/+10
2019-03-13 Harald Anlauf <anlauf@gmx.de> PR fortran/87045 * trans-expr.c (gfc_trans_pointer_assignment): Move check for same string length so that we do not get false errors for deferred length. PR fortran/87045 * gfortran.dg/pr87045.f90: New test. From-SVN: r269664
2019-03-12Replace can't in error messages for Fortran.Martin Liska1-2/+2
2019-03-12 Martin Liska <mliska@suse.cz> * c-opts.c (c_common_handle_option): Wrap option with %< and %>. 2019-03-12 Martin Liska <mliska@suse.cz> * decl.c (add_init_expr_to_sym): Replace usage of 'can't' with 'cannot'. (variable_decl): Likewise. (cray_pointer_decl): Likewise. (match_binding_attributes): Likewise. * f95-lang.c (gfc_init): Likewise. * interface.c (gfc_check_typebound_override): Likewise. * intrinsic.c (make_generic): Likewise. * module.c (dump_module): Likewise. (gfc_use_module): Likewise. * primary.c (gfc_convert_to_structure_constructor): Likewise. * resolve.c (resolve_entries): Likewise. (check_generic_tbp_ambiguity): Likewise. (get_checked_tb_operator_target): Likewise. * scanner.c (load_file): Likewise. * trans-expr.c (gfc_conv_intrinsic_to_class): Likewise. 2019-03-12 Martin Liska <mliska@suse.cz> * config/i386/i386.c: Reword an error message. 2019-03-12 Martin Liska <mliska@suse.cz> * gfortran.dg/abstract_type_3.f03: Amend test-case scan patterns. * gfortran.dg/binding_label_tests_4.f03: Likewise. * gfortran.dg/c_f_pointer_tests_6.f90: Likewise. * gfortran.dg/c_funloc_tests_6.f90: Likewise. * gfortran.dg/c_loc_tests_17.f90: Likewise. * gfortran.dg/constructor_9.f90: Likewise. * gfortran.dg/dec_structure_8.f90: Likewise. * gfortran.dg/entry_4.f90: Likewise. * gfortran.dg/init_char_with_nonchar_ctr.f90: Likewise. * gfortran.dg/initialization_23.f90: Likewise. * gfortran.dg/logical_assignment_1.f90: Likewise. * gfortran.dg/pr80752.f90: Likewise. * gfortran.dg/pr88116_1.f90: Likewise. * gfortran.dg/pr88467.f90: Likewise. * gfortran.dg/typebound_call_7.f03: Likewise. * gfortran.dg/typebound_generic_1.f03: Likewise. * gfortran.dg/typebound_operator_2.f03: Likewise. * gfortran.dg/typebound_operator_4.f03: Likewise. * gfortran.dg/typebound_proc_9.f03: Likewise. * gfortran.dg/unlimited_polymorphic_2.f03: Likewise. From-SVN: r269616
2019-03-12re PR fortran/89363 (RANK incorrect for unallocated allocatable)Paul Thomas1-0/+79
2019-03-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/89363 PR fortran/89364 * trans-expr.c (set_dtype_for_unallocated): New function. (gfc_conv_gfc_desc_to_cfi_desc): Call it for allocatable and pointer arguments. (gfc_conv_procedure_call): Likewise. Also, set the ubound of the final dimension to -1 for assumed rank formal args that are associated with assumed size arrays. * trans-intrinsic.c (gfc_conv_intrinsic_bound): Return -1 for the final dimension of assumed rank entities that are argument associated with assumed size arrays. (gfc_conv_intrinsic_shape): Likewise return -1 for the final dimension of the shape intrinsic. 2019-03-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/89363 * gfortran.dg/assumed_rank_16.f90: New test. PR fortran/89364 * gfortran.dg/assumed_rank_17.f90: New test. From-SVN: r269612
2019-02-24re PR fortran/89174 (Allocation segfault with CLASS(*) MOLD)Thomas Koenig1-2/+5
2019-02-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/89174 * trans-expr.c (gfc_find_and_cut_at_last_class_ref): Add is_mold to garguments. If we are dealing with a MOLD, call gfc_expr_to_initialize(). * trans-stmt.c (gfc_trans_allocate): For MOLD, pass is_mold=true to gfc_find_and_cut_at_last_class_ref. * trans.h (gfc_find_and_cut_at_last_class_ref): Add optional argument is_mold with default false. 2019-02-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/89174 * gfortran.dg/allocate_with_mold_3.f90: New test. From-SVN: r269179
2019-02-23re PR fortran/88117 (ICE in gimplify_var_or_parm_decl, at gimplify.c:2697)Paul Thomas1-1/+3
2019-02-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/88117 * resolve.c (deferred_op_assign): Return if the lhs expression has the pointer attribute. * trans-expr.c (gfc_trans_assignment_1): Do not fix the string length if the lhs expression has the pointer attribute. 2019-02-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/88117 * gfortran.dg/deferred_character_32.f90 : New test From-SVN: r269157
2019-02-23re PR fortran/89385 (Incorrect members of C descriptor for an allocatable ↵Paul Thomas1-6/+40
object) 2019-02-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/89385 PR fortran/89366 * decl.c (gfc_verify_c_interop_param): Restriction on string length being one is lifted for F2018. * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): For scalar characters with intent in, make a temporary and copy the result of the expression evaluation into it. (gfc_conv_procedure_call): Set a flag for character formal args having a character length that is not unity. If the procedure is bind C, call gfc_conv_gfc_desc_to_cfi_desc in this case. Also, extend bind C calls to unconditionally convert both pointers and allocatable expressions. 2019-02-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/89385 * gfortran.dg/ISO_Fortran_binding_1.f90 : Correct test for previously incorrect lbound for allocatable expressions. Also correct stop values to avoid repetition. * gfortran.dg/ISO_Fortran_binding_5.f90 : New test * gfortran.dg/ISO_Fortran_binding_5.c : Support previous test. PR fortran/89366 * gfortran.dg/ISO_Fortran_binding_6.f90 : New test * gfortran.dg/ISO_Fortran_binding_6.c : Support previous test. * gfortran.dg/pr32599.f03 : Set standard to F2008. 2019-02-23 Paul Thomas <pault@gcc.gnu.org> PR fortran/89385 PR fortran/89366 * runtime/ISO_Fortran_binding.c (cfi_desc_to_gfc_desc) : In the interchange between character and derived, the character type was being set incorrectly. (gfc_desc_to_cfi_desc) : Eliminate the interchange of types in this function. Do not add the kind and length information to the type field of structures. Lbounds were incorrectly being set to zero for allocatable and pointer descriptors. Should have been non-pointer, non-allocatables that received this treatment. From-SVN: r269156
2019-02-19re PR fortran/89384 (CONTIGUOUS dummy argument in BIND(C) interface ↵Thomas Koenig1-1/+6
incorrect when actual is non-contiguous) 2019-02-19 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/89384 * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): If the dummy argument is contiguous and the actual argument may not be, use gfc_conv_subref_array_arg. 2019-02-19 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/89384 * gfortran.dg/ISO_Fortran_binding_4.f90 From-SVN: r269024
2019-02-18re PR fortran/87689 (PowerPC64 ELFv2 function parameter passing violation)Thomas Koenig1-3/+4
2019-02-18 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/87689 * trans-decl.c (gfc_get_extern_function_decl): Add argument actual_args and pass it through to gfc_get_function_type. * trans-expr.c (conv_function_val): Add argument actual_args and pass it on to gfc_get_extern_function_decl. (conv_procedure_call): Pass actual arguments to conv_function_val. * trans-types.c (get_formal_from_actual_arglist): New function. (gfc_get_function_type): Add argument actual_args. Generate formal args from actual args if necessary. * trans-types.h (gfc_get_function_type): Add optional argument. * trans.h (gfc_get_extern_function_decl): Add optional argument. 2019-02-18 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/87689 * gfortran.dg/lto/20091028-1_0.f90: Add -Wno-lto-type-mismatch to options. * gfortran.dg/lto/20091028-2_0.f90: Likewise. * gfortran.dg/lto/pr87689_0.f: New file. * gfortran.dg/lto/pr87689_1.f: New file. From-SVN: r268992
2019-02-02re PR fortran/88393 ([OOP] Segfault with type-bound assignment)Paul Thomas1-10/+10
2019-02-02 Paul Thomas <pault@gcc.gnu.org> PR fortran/88393 * trans-expr.c (gfc_conv_procedure_call): For derived entities, passed in parentheses to class formals, invert the order of copying allocatable components to taking the _data of the class expression. 2019-02-02 Paul Thomas <pault@gcc.gnu.org> PR fortran/88393 * gfortran.dg/alloc_comp_assign_16.f03 : New test. From-SVN: r268474
2019-01-24re PR fortran/88929 (ICE on building MPICH 3.2 with GCC 9 with ↵Paul Thomas1-8/+55
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-22re PR fortran/88579 (Calculating power of powers of two)Harald Anlauf1-36/+60
2019-01-22 Harald Anlauf <anlauf@gmx.de> PR fortran/88579 * trans-expr.c (gfc_conv_power_op): Handle cases of (2**e) ** integer and (- 2**e) ** integer. 2019-01-22 Harald Anlauf <anlauf@gmx.de> PR fortran/88579 * gfortran.dg/power_8.f90: New test. From-SVN: r268163
2019-01-19re PR fortran/56789 (Handling of contiguous dummy arguments)Thomas Koenig1-0/+7
2018-01-19 Thomas Koenig <tkoenig@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> PR fortran/56789 * trans-expr.c (gfc_conv_procedure_call): Call gfc_conv_subref_array_arg if the formal arg is contiguous and the actual arg may not be. 2018-01-19 Thomas Koenig <tkoenig@gcc.gnu.org> Paul Thomas <pault@gcc.gnu.org> PR fortran/56789 * gfortran.dg/contiguous_3.f90: Make code compilant. Remove scan-tree tests that fail with patch. * gfortran.dg/contiguous_8.f90: New test. Co-Authored-By: Paul Thomas <pault@gcc.gnu.org> From-SVN: r268096
2019-01-15trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Deal with exprs that are ↵Paul Thomas1-1/+10
indirect references; ie. 2019-01-15 Paul Thomas <pault@gcc.gnu.org> * trans-expr.c (gfc_conv_gfc_desc_to_cfi_desc): Deal with exprs that are indirect references; ie. dummy arguments. 2019-01-15 Paul Thomas <pault@gcc.gnu.org> * gfortran.dg/ISO_Fortran_binding_2.c : Change reference to ISO_Fortran_binding_2.h. From-SVN: r267946
2019-01-12gfortran.texi: Add description in sections on TS 29113 and further ↵Paul Thomas1-2/+117
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-08re PR fortran/88611 (ICE in eliminate_stmt, at tree-ssa-sccvn.c:5011)Richard Biener1-13/+6
2019-01-08 Richard Biener <rguenther@suse.de> PR fortran/88611 * trans-expr.c (gfc_conv_initializer): For ISOCBINDING_NULL_* directly build the expected GENERIC tree. * gfortran.dg/pr88611.f90: New testcase. From-SVN: r267721
2019-01-01Update copyright years.Jakub Jelinek1-1/+1
From-SVN: r267494
2018-12-31re PR fortran/82995 (Segmentation fault passing optional argument to ↵Thomas Koenig1-9/+13
intrinsic sum function) 2018-12-31 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/82995 * trans-expr.c (gfc_conv_procedure_call): Pass NULL pointer for missing optional dummy arguments for library routines. * trans-intinsic.c (conv_mask_condition): New function. (gfc_conv_intrinsic_arith): Detect and handle optional mask. (gfc_conv_intrinsic_minmaxloc): Likewise. (gfc_conv_intrinsic_findloc): Likewise. (gfc_conv_intrinsic_minmaxval): Likewise. (gfc_inline_intrinsic_function_p): Do not inline for rank > 1 if an optional mask is present. 2018-12-31 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/82995 * m4/ifindloc0.m4: Handle case of absend optional argument, passed as a NULL pointer. Correct allocation of retarray->base_addr. * m4/ifindloc1.m4: Likewise. * m4/ifindloc2.m4: Handle case of absend optional argument, passed as a NULL pointer. * m4/iforeach-s.m4: Likewise. * m4/iforeach-s2.m4: Likewise. * m4/iforeach.m4: Likewise. * m4/ifunction-s.m4: Likewise. * m4/ifunction-s2.m4: Likewise. * m4/ifunction.m4: Likewise. * generated/findloc0_c16.c: Regenerated. * generated/findloc0_c4.c: Regenerated. * generated/findloc0_c8.c: Regenerated. * generated/findloc0_i1.c: Regenerated. * generated/findloc0_i16.c: Regenerated. * generated/findloc0_i2.c: Regenerated. * generated/findloc0_i4.c: Regenerated. * generated/findloc0_i8.c: Regenerated. * generated/findloc0_r16.c: Regenerated. * generated/findloc0_r4.c: Regenerated. * generated/findloc0_r8.c: Regenerated. * generated/findloc0_s1.c: Regenerated. * generated/findloc0_s4.c: Regenerated. * generated/findloc1_c16.c: Regenerated. * generated/findloc1_c4.c: Regenerated. * generated/findloc1_c8.c: Regenerated. * generated/findloc1_i1.c: Regenerated. * generated/findloc1_i16.c: Regenerated. * generated/findloc1_i2.c: Regenerated. * generated/findloc1_i4.c: Regenerated. * generated/findloc1_i8.c: Regenerated. * generated/findloc1_r16.c: Regenerated. * generated/findloc1_r4.c: Regenerated. * generated/findloc1_r8.c: Regenerated. * generated/findloc1_s1.c: Regenerated. * generated/findloc1_s4.c: Regenerated. * generated/findloc2_s1.c: Regenerated. * generated/findloc2_s4.c: Regenerated. * generated/iall_i1.c: Regenerated. * generated/iall_i16.c: Regenerated. * generated/iall_i2.c: Regenerated. * generated/iall_i4.c: Regenerated. * generated/iall_i8.c: Regenerated. * generated/iany_i1.c: Regenerated. * generated/iany_i16.c: Regenerated. * generated/iany_i2.c: Regenerated. * generated/iany_i4.c: Regenerated. * generated/iany_i8.c: Regenerated. * generated/iparity_i1.c: Regenerated. * generated/iparity_i16.c: Regenerated. * generated/iparity_i2.c: Regenerated. * generated/iparity_i4.c: Regenerated. * generated/iparity_i8.c: Regenerated. * generated/maxloc0_16_i1.c: Regenerated. * generated/maxloc0_16_i16.c: Regenerated. * generated/maxloc0_16_i2.c: Regenerated. * generated/maxloc0_16_i4.c: Regenerated. * generated/maxloc0_16_i8.c: Regenerated. * generated/maxloc0_16_r10.c: Regenerated. * generated/maxloc0_16_r16.c: Regenerated. * generated/maxloc0_16_r4.c: Regenerated. * generated/maxloc0_16_r8.c: Regenerated. * generated/maxloc0_16_s1.c: Regenerated. * generated/maxloc0_16_s4.c: Regenerated. * generated/maxloc0_4_i1.c: Regenerated. * generated/maxloc0_4_i16.c: Regenerated. * generated/maxloc0_4_i2.c: Regenerated. * generated/maxloc0_4_i4.c: Regenerated. * generated/maxloc0_4_i8.c: Regenerated. * generated/maxloc0_4_r10.c: Regenerated. * generated/maxloc0_4_r16.c: Regenerated. * generated/maxloc0_4_r4.c: Regenerated. * generated/maxloc0_4_r8.c: Regenerated. * generated/maxloc0_4_s1.c: Regenerated. * generated/maxloc0_4_s4.c: Regenerated. * generated/maxloc0_8_i1.c: Regenerated. * generated/maxloc0_8_i16.c: Regenerated. * generated/maxloc0_8_i2.c: Regenerated. * generated/maxloc0_8_i4.c: Regenerated. * generated/maxloc0_8_i8.c: Regenerated. * generated/maxloc0_8_r10.c: Regenerated. * generated/maxloc0_8_r16.c: Regenerated. * generated/maxloc0_8_r4.c: Regenerated. * generated/maxloc0_8_r8.c: Regenerated. * generated/maxloc0_8_s1.c: Regenerated. * generated/maxloc0_8_s4.c: Regenerated. * generated/maxloc1_16_i1.c: Regenerated. * generated/maxloc1_16_i16.c: Regenerated. * generated/maxloc1_16_i2.c: Regenerated. * generated/maxloc1_16_i4.c: Regenerated. * generated/maxloc1_16_i8.c: Regenerated. * generated/maxloc1_16_r10.c: Regenerated. * generated/maxloc1_16_r16.c: Regenerated. * generated/maxloc1_16_r4.c: Regenerated. * generated/maxloc1_16_r8.c: Regenerated. * generated/maxloc1_16_s1.c: Regenerated. * generated/maxloc1_16_s4.c: Regenerated. * generated/maxloc1_4_i1.c: Regenerated. * generated/maxloc1_4_i16.c: Regenerated. * generated/maxloc1_4_i2.c: Regenerated. * generated/maxloc1_4_i4.c: Regenerated. * generated/maxloc1_4_i8.c: Regenerated. * generated/maxloc1_4_r10.c: Regenerated. * generated/maxloc1_4_r16.c: Regenerated. * generated/maxloc1_4_r4.c: Regenerated. * generated/maxloc1_4_r8.c: Regenerated. * generated/maxloc1_4_s1.c: Regenerated. * generated/maxloc1_4_s4.c: Regenerated. * generated/maxloc1_8_i1.c: Regenerated. * generated/maxloc1_8_i16.c: Regenerated. * generated/maxloc1_8_i2.c: Regenerated. * generated/maxloc1_8_i4.c: Regenerated. * generated/maxloc1_8_i8.c: Regenerated. * generated/maxloc1_8_r10.c: Regenerated. * generated/maxloc1_8_r16.c: Regenerated. * generated/maxloc1_8_r4.c: Regenerated. * generated/maxloc1_8_r8.c: Regenerated. * generated/maxloc1_8_s1.c: Regenerated. * generated/maxloc1_8_s4.c: Regenerated. * generated/maxval0_s1.c: Regenerated. * generated/maxval0_s4.c: Regenerated. * generated/maxval1_s1.c: Regenerated. * generated/maxval1_s4.c: Regenerated. * generated/maxval_i1.c: Regenerated. * generated/maxval_i16.c: Regenerated. * generated/maxval_i2.c: Regenerated. * generated/maxval_i4.c: Regenerated. * generated/maxval_i8.c: Regenerated. * generated/maxval_r10.c: Regenerated. * generated/maxval_r16.c: Regenerated. * generated/maxval_r4.c: Regenerated. * generated/maxval_r8.c: Regenerated. * generated/minloc0_16_i1.c: Regenerated. * generated/minloc0_16_i16.c: Regenerated. * generated/minloc0_16_i2.c: Regenerated. * generated/minloc0_16_i4.c: Regenerated. * generated/minloc0_16_i8.c: Regenerated. * generated/minloc0_16_r10.c: Regenerated. * generated/minloc0_16_r16.c: Regenerated. * generated/minloc0_16_r4.c: Regenerated. * generated/minloc0_16_r8.c: Regenerated. * generated/minloc0_16_s1.c: Regenerated. * generated/minloc0_16_s4.c: Regenerated. * generated/minloc0_4_i1.c: Regenerated. * generated/minloc0_4_i16.c: Regenerated. * generated/minloc0_4_i2.c: Regenerated. * generated/minloc0_4_i4.c: Regenerated. * generated/minloc0_4_i8.c: Regenerated. * generated/minloc0_4_r10.c: Regenerated. * generated/minloc0_4_r16.c: Regenerated. * generated/minloc0_4_r4.c: Regenerated. * generated/minloc0_4_r8.c: Regenerated. * generated/minloc0_4_s1.c: Regenerated. * generated/minloc0_4_s4.c: Regenerated. * generated/minloc0_8_i1.c: Regenerated. * generated/minloc0_8_i16.c: Regenerated. * generated/minloc0_8_i2.c: Regenerated. * generated/minloc0_8_i4.c: Regenerated. * generated/minloc0_8_i8.c: Regenerated. * generated/minloc0_8_r10.c: Regenerated. * generated/minloc0_8_r16.c: Regenerated. * generated/minloc0_8_r4.c: Regenerated. * generated/minloc0_8_r8.c: Regenerated. * generated/minloc0_8_s1.c: Regenerated. * generated/minloc0_8_s4.c: Regenerated. * generated/minloc1_16_i1.c: Regenerated. * generated/minloc1_16_i16.c: Regenerated. * generated/minloc1_16_i2.c: Regenerated. * generated/minloc1_16_i4.c: Regenerated. * generated/minloc1_16_i8.c: Regenerated. * generated/minloc1_16_r10.c: Regenerated. * generated/minloc1_16_r16.c: Regenerated. * generated/minloc1_16_r4.c: Regenerated. * generated/minloc1_16_r8.c: Regenerated. * generated/minloc1_16_s1.c: Regenerated. * generated/minloc1_16_s4.c: Regenerated. * generated/minloc1_4_i1.c: Regenerated. * generated/minloc1_4_i16.c: Regenerated. * generated/minloc1_4_i2.c: Regenerated. * generated/minloc1_4_i4.c: Regenerated. * generated/minloc1_4_i8.c: Regenerated. * generated/minloc1_4_r10.c: Regenerated. * generated/minloc1_4_r16.c: Regenerated. * generated/minloc1_4_r4.c: Regenerated. * generated/minloc1_4_r8.c: Regenerated. * generated/minloc1_4_s1.c: Regenerated. * generated/minloc1_4_s4.c: Regenerated. * generated/minloc1_8_i1.c: Regenerated. * generated/minloc1_8_i16.c: Regenerated. * generated/minloc1_8_i2.c: Regenerated. * generated/minloc1_8_i4.c: Regenerated. * generated/minloc1_8_i8.c: Regenerated. * generated/minloc1_8_r10.c: Regenerated. * generated/minloc1_8_r16.c: Regenerated. * generated/minloc1_8_r4.c: Regenerated. * generated/minloc1_8_r8.c: Regenerated. * generated/minloc1_8_s1.c: Regenerated. * generated/minloc1_8_s4.c: Regenerated. * generated/minval0_s1.c: Regenerated. * generated/minval0_s4.c: Regenerated. * generated/minval1_s1.c: Regenerated. * generated/minval1_s4.c: Regenerated. * generated/minval_i1.c: Regenerated. * generated/minval_i16.c: Regenerated. * generated/minval_i2.c: Regenerated. * generated/minval_i4.c: Regenerated. * generated/minval_i8.c: Regenerated. * generated/minval_r10.c: Regenerated. * generated/minval_r16.c: Regenerated. * generated/minval_r4.c: Regenerated. * generated/minval_r8.c: Regenerated. * generated/product_c10.c: Regenerated. * generated/product_c16.c: Regenerated. * generated/product_c4.c: Regenerated. * generated/product_c8.c: Regenerated. * generated/product_i1.c: Regenerated. * generated/product_i16.c: Regenerated. * generated/product_i2.c: Regenerated. * generated/product_i4.c: Regenerated. * generated/product_i8.c: Regenerated. * generated/product_r10.c: Regenerated. * generated/product_r16.c: Regenerated. * generated/product_r4.c: Regenerated. * generated/product_r8.c: Regenerated. * generated/sum_c10.c: Regenerated. * generated/sum_c16.c: Regenerated. * generated/sum_c4.c: Regenerated. * generated/sum_c8.c: Regenerated. * generated/sum_i1.c: Regenerated. * generated/sum_i16.c: Regenerated. * generated/sum_i2.c: Regenerated. * generated/sum_i4.c: Regenerated. * generated/sum_i8.c: Regenerated. * generated/sum_r10.c: Regenerated. * generated/sum_r16.c: Regenerated. * generated/sum_r4.c: Regenerated. * generated/sum_r8.c: Regenerated. 2018-12-31 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/82995 * gfortran.dg/optional_absent_4.f90: New test. * gfortran.dg/optional_absent_5.f90: New test. From-SVN: r267487
2018-12-22re PR fortran/85544 (ICE in gfc_conv_scalarized_array_ref, at ↵Thomas Koenig1-0/+77
fortran/trans-array.c:3385) 2018-12-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/85544 * frontend-passes.c (optimize_power): Remove. (optimize_op): Remove call to optimize_power. * trans-expr.c (gfc_conv_power_op): Handle cases of 1**integer, (2|4|8|16) ** integer and (-1) ** integer. 2018-12-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/85544 * gfortran.dg/power_7.f90: New test. From-SVN: r267347
2018-12-16PF fortran/88364Thomas Koenig1-1/+1
2018-12-16 Thomas Koenig <tkoenig@gcc.gnu.org> PF fortran/88364 * trans-expr.c (gfc_conv_expr_reference): Do not add clobber if the expression contains a reference. 2018-12-16 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/88363 * intent_out_13.f90: New test. From-SVN: r267187
2018-11-01re PR fortran/40196 ([F03] [F08] Type parameter inquiry (str%len, a%kind) ↵Paul Thomas1-0/+41
and Complex parts (z%re, z%im)) 2018-11-01 Paul Thomas <pault@gcc.gnu.org> PR fortran/40196 * dependency.c (are_identical_variables): Return false if the inquiry refs are not the same. (gfc_ref_needs_temporary_p): Break on an inquiry ref. * dump_parse_tree.c (show_ref): Show the inquiry ref type. * expr.c (gfc_free_ref_list): Break on an inquiry ref. (gfc_copy_ref): Copy the inquiry ref types. (find_inquiry_ref): New function. (simplify_const_ref, simplify_ref_chain): Call it. Add new arg to simplify_ref_chain. (gfc_simplify_expr): Use the new arg in call to simplify_ref_chain. (gfc_get_full_arrayspec_from_expr, gfc_is_coarray): Break on inquiry ref. (gfc_traverse_expr): Return true for inquiry ref. * frontend-passes.c (gfc_expr_walker): Break on inquiry ref. * gfortran.h : Add enums and union member in gfc_ref to implement inquiry refs. * intrinsic.c : Fix white nois. * match.c (gfc_match_assignment): A constant lavlue is an error. * module.c : Add DECL_MIO_NAME for inquiry_type and the mstring for inquiry_types. (mio_ref): Handle inquiry refs. * primary.c (is_inquiry_ref): New function. (gfc_match_varspec): Handle inquiry refs calling new function. (gfc_variable_attr): Detect inquiry ref for disambiguation with components. (caf_variable_attr): Treat inquiry and substring refs in the same way. * resolve.c (find_array_spec): ditto. (gfc_resolve_substring_charlen): If there is neither a charlen ref not an inquiry ref, return. (resolve_ref): Handle inqiry refs as appropriate. (resolve_allocate_expr): Entities with an inquiry ref cannot be allocated. * simplify.c (simplify_bound, simplify_cobound): Punt on inquiry refs. * trans-array.c (get_array_ctor_var_strlen): Break on inquiry ref. *trans-expr.c (conv_inquiry): New function. (gfc_conv_variable): Retain the last typespec to pass to conv_inquiry on detecting an inquiry ref. 2018-11-01 Paul Thomas <pault@gcc.gnu.org> PR fortran/40196 * gfortran.dg/inquiry_part_ref_1.f08: New test. * gfortran.dg/inquiry_part_ref_2.f90: New test. * gfortran.dg/inquiry_part_ref_3.f90: New test. From-SVN: r265729
2018-10-21re PR fortran/71880 (pointer to allocatable character)Paul Thomas1-0/+13
2018-10-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/71880 * trans-expr.c (gfc_trans_pointer_assignment): Set the string length for array valued deferred length lhs. 2018-10-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/71880 * gfortran.dg/deferred_character_31.f90 : New test. From-SVN: r265353
2018-10-15re PR fortran/87566 (ICE with class(*) and select)Paul Thomas1-2/+3
2018-10-15 Paul Thomas <pault@gcc.gnu.org> Tobias Burnus <burnus@gcc.gnu.org> PR fortran/87566 * resolve.c (resolve_assoc_var): Add missing array spec for class associate names. (resolve_select_type): Handle case where last typed component of the selector has a different type to the expression. * trans-expr.c (gfc_find_and_cut_at_last_class_ref): Replace call to gfc_expr_to_initialize with call to gfc_copy_expr. (gfc_conv_class_to_class): Guard assignment to 'len' field against case where zero constant is supplied. 2018-10-15 Paul Thomas <pault@gcc.gnu.org> Tobias Burnus <burnus@gcc.gnu.org> PR fortran/87566 * gfortran.dg/select_type_44.f90: New test. * gfortran.dg/associate_42.f90: New test. Co-Authored-By: Tobias Burnus <burnus@gcc.gnu.org> From-SVN: r265171
2018-10-01re PR fortran/65677 (Incomplete assignment on deferred-length character ↵Paul Thomas1-2/+2
variable) 2018-10-01 Paul Thomas <pault@gcc.gnu.org> PR fortran/65677 * trans-expr.c (gfc_trans_assignment_1): Set the 'identical' flag in the call to gfc_check_dependency. 2018-10-01 Paul Thomas <pault@gcc.gnu.org> PR fortran/65677 * gfortran.dg/dependency_52.f90 : Expand the test to check both the call to adjustl and direct assignment of the substring. From-SVN: r264759
2018-09-29re PR fortran/65677 (Incomplete assignment on deferred-length character ↵Paul Thomas1-1/+5
variable) 2018-09-29 Paul Thomas <pault@gcc.gnu.org> PR fortran/65667 * trans-expr.c (gfc_trans_assignment_1): If there is dependency fix the rse stringlength. 2018-09-29 Paul Thomas <pault@gcc.gnu.org> PR fortran/65667 * gfortran.dg/dependency_52.f90 : New test. From-SVN: r264715
2018-09-24re PR fortran/87397 (Clobbering intent(out) variables caused regression in ↵Thomas Koenig1-0/+1
OpenCoarrays testsuite) 2018-09-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/87397 * gfc_conv_procedure_call: Do not add clobber on INTENT(OUT) for variables in an associate statement. 2018-09-24 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/87401 * gfortran.dg/intent_out_12.f90: New test. From-SVN: r264539
2018-09-23re PR fortran/87397 (Clobbering intent(out) variables caused regression in ↵Thomas Koenig1-0/+1
OpenCoarrays testsuite) 2018-09-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/87397 * gfc_conv_procedure_call: Do not add clobber on INTENT(OUT) for variables having the dimension attribute. 2018-09-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/87395 * gfortran.dg/intent_out_11.f90: New test. From-SVN: r264518
2018-09-23Do array index calculations in gfc_array_index_typeJanne Blomqvist1-23/+19
It was recently noticed that for a few of the coarray intrinsics array index calculations were done in integer_type_node instead of gfc_array_index_type. This patch fixes this. Regtested on x86_64-pc-linux-gnu. gcc/fortran/ChangeLog: 2018-09-23 Janne Blomqvist <jb@gcc.gnu.org> * trans-expr.c (gfc_caf_get_image_index): Do array index calculations in gfc_array_index_type. * trans-intrinsic.c (conv_intrinsic_event_query): Likewise. * trans-stmt.c (gfc_trans_lock_unlock): Likewise. (gfc_trans_event_post_wait): Likewise. gcc/testsuite/ChangeLog: 2018-09-23 Janne Blomqvist <jb@gcc.gnu.org> * gfortran.dg/coarray_lib_alloc_4.f90: Fix scan patterns. * gfortran.dg/coarray_lock_7.f90: Likewise. From-SVN: r264513
2018-09-23re PR fortran/87395 (ICE in in lookup_field_for_decl with whizard)Thomas Koenig1-1/+4
2018-09-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/87395 * gfc_conv_procedure_call: Reformat comments slightly. Do not add clobber on INTENT(OUT) for saved variables. 2018-09-23 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/87395 * gfortran.dg/intent_out_10.f90: New test. From-SVN: r264512
2018-09-22re PR middle-end/41453 (use INTENT(out) for optimization)Thomas Koenig1-3/+22
2018-09-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/41453 * trans.h (gfc_conv_expr_reference): Add optional argument add_clobber to prototype. (gfc_conv_procedure_call): Set add_clobber argument to gfc_conv_procedure_reference to true for scalar, INTENT(OUT), non-pointer, non-allocatable, non-dummy variables whose type is neither BT_CHARACTER, BT_DERIVED or BT_CLASS, but only if the procedure is not elemental. * trans-expr.c (gfc_conv_procedure_reference): Add clobber statement before call if add_clobber is set. 2018-09-22 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/41453 * gfortran.dg/intent_optimize_2.f90: New test. From-SVN: r264506
2018-09-21re PR fortran/77325 (ICE in gimplify_var_or_parm_decl, at gimplify.c:1933)Paul Thomas1-5/+9
2018-09-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/77325 * trans-array.c (gfc_alloc_allocatable_for_assignment): If the rhs has a charlen expression, convert that and use it. * trans-expr.c (gfc_trans_assignment_1): The rse.pre for the assignment of deferred character array vars to a realocatable lhs should not be added to the exterior block since vector indices, for example, generate temporaries indexed within the loop. 2018-09-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/77325 * gfortran.dg/deferred_character_22.f90 : New test. From-SVN: r264486
2018-09-21Fix co-array allocationAndrew Stubbs1-1/+1
The Fortran front-end has a bug in which it uses "int" values for "size_t" parameters. I don't know why this isn't problem for all 64-bit architectures, but GCN ends up with the data in the wrong argument register and/or stack slot, and bad things happen. This patch corrects the issue by setting the correct type. 2018-09-21 Andrew Stubbs <ams@codesourcery.com> Kwok Cheung Yeung <kcy@codesourcery.com> gcc/fortran/ * trans-expr.c (gfc_trans_structure_assign): Ensure that the first argument of a call to _gfortran_caf_register is of size_type_node. * trans-intrinsic.c (conv_intrinsic_event_query): Convert computed index to a size_type_node type. * trans-stmt.c (gfc_trans_event_post_wait): Likewise. Co-Authored-By: Kwok Cheung Yeung <kcy@codesourcery.com> From-SVN: r264468
2018-09-20gfortran.h (gfc_str_startswith): New macro.Janus Weil1-4/+4
2018-09-20 Janus Weil <janus@gcc.gnu.org> * gfortran.h (gfc_str_startswith): New macro. * decl.c (variable_decl, gfc_match_end): Use it. * iresolve.c (is_trig_resolved): Ditto. * module.c (load_omp_udrs, read_module): Ditto. * options.c (gfc_handle_runtime_check_option): Ditto. * primary.c (match_arg_list_function): Ditto. * trans-decl.c (gfc_get_symbol_decl): Ditto. * trans-expr.c (gfc_conv_procedure_call): Ditto. * interface.c (dtio_op): Replace strncmp by strcmp. * resolve.c (resolve_actual_arglist, resolve_function): Ditto. * trans-expr.c (conv_arglist_function): Ditto. * trans-intrinsic.c (gfc_conv_ieee_arithmetic_function): Replace macro STARTS_WITH by gfc_str_startswith. From-SVN: r264448
2018-09-19re PR fortran/84109 (ICE in adjustl on allocatable array of strings)Paul Thomas1-4/+5
2018-09-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/84109 * trans-expr.c (gfc_trans_assignment_1): The rse.pre for the assignment of deferred character intrinsic elemental function results to a realocatable lhs must not be added to the exterior block if they are array valued but must go to the loop body. 2018-09-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/84109 * gfortran.dg/elemental_function_3.f90 : New test. From-SVN: r264427
2018-09-18re PR fortran/87239 (ICE in deferred-length string)Paul Thomas1-2/+5
2018-09-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/87239 * trans-expr.c (gfc_trans_assignment_1): The rse.pre for the assignment of deferred character elemental function results to a realocatable lhs must not be added to the exterior block but must go to the loop body. 2018-09-18 Paul Thomas <pault@gcc.gnu.org> PR fortran/87239 * gfortran.dg/elemental_function_2.f90 : New test. From-SVN: r264409
2018-09-17re PR fortran/85954 (ICE in make_ssa_name_fn, at tree-ssanames.c:266)Paul Thomas1-1/+2
2018-09-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/85954 * resolve.c (resolve_assoc_var): If the target expression is a deferred charlen dummy and the associate name shares the charlen, generate a new one. Make sure that new charlens are in the namespace list so that they get cleaned up. * trans-array.c (gfc_is_reallocatable_lhs): Associate names are not reallocatable. * trans-decl.c (gfc_get_symbol_decl): Put deferred character length dummy and result arrays on the deferred initialization list so that the variable length arrays can be correctly dealt with. * trans-expr.c (gfc_conv_string_length): Return if 'expr' is NULL rather than ICEing.. 2018-09-17 Paul Thomas <pault@gcc.gnu.org> PR fortran/85954 * gfortran.dg/deferred_character_21.f90 : New test. From-SVN: r264358
2018-09-12re PR fortran/87284 (Allocation of class arrays with mold results in ↵Paul Thomas1-1/+4
"conditional jump or move depends on uninitialised value") 2018-09-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/87284 * trans-expr.c (gfc_trans_class_init_assign): Access to to array elements of the dynamic type requires that the array reference be added to the class expression and not the _data component, unlike scalar expressions. 2018-09-12 Paul Thomas <pault@gcc.gnu.org> PR fortran/87284 * gfortran.dg/allocate_with_mold_2.f90: New test. From-SVN: r264249
2018-08-28re PR fortran/80477 ([OOP] Polymorphic function result generates memory leak)Paul Thomas1-18/+107
2017-08-28 Paul Thomas <pault@gcc.gnu.org> PR fortran/80477 * trans-expr.c (gfc_conv_procedure_call): Allocatable class scalar results being passed to a derived type formal argument are finalized if possible. Otherwise, rely on existing code for deallocation. Make the deallocation of allocatable result components conditional on finalization not taking place. Make the freeing of data components after finalization conditional on the data being NULL. (gfc_trans_arrayfunc_assign): Change the gcc_assert to a condition to return NULL_TREE. (gfc_trans_assignment_1): If the assignment is class to class and the rhs expression must be finalized but the assignment is not marked as a polymorphic assignment, use the vptr copy function instead of gfc_trans_scalar_assign. PR fortran/86481 * trans-expr.c (gfc_conv_expr_reference): Do not add the post block to the pre block if the expression is to be finalized. * trans-stmt.c (gfc_trans_allocate): If the expr3 must be finalized, load the post block into a finalization block and add it right at the end of the allocation block. 2017-08-28 Paul Thomas <pault@gcc.gnu.org> PR fortran/80477 * gfortran.dg/class_result_7.f90: New test. * gfortran.dg/class_result_8.f90: New test. * gfortran.dg/class_result_9.f90: New test. PR fortran/86481 * gfortran.dg/allocate_with_source_25.f90: New test. From-SVN: r263916
2018-08-10re PR fortran/57160 (short-circuit IF only with -ffrontend-optimize)Janus Weil1-2/+2
2018-08-10 Janus Weil <janus@gcc.gnu.org> PR fortran/57160 * invoke.texi (frontend-optimize): Mention short-circuiting. * options.c (gfc_post_options): Disable -ffrontend-optimize with -Og. * resolve.c (resolve_operator): Warn about short-circuiting only with -ffrontend-optimize. * trans-expr.c (gfc_conv_expr_op): Use short-circuiting operators only with -ffrontend-optimize. Without that flag, make sure that both operands are evaluated. 2018-08-10 Janus Weil <janus@gcc.gnu.org> PR fortran/57160 * gfortran.dg/actual_pointer_function_1.f90: Fix invalid test case. * gfortran.dg/inline_matmul_23.f90: Add option "-ffrontend-optimize". * gfortran.dg/short_circuiting_2.f90: New test case. * gfortran.dg/short_circuiting_3.f90: New test case. From-SVN: r263471
2018-06-21re PR fortran/49630 ([OOP] ICE on obsolescent deferred-length type bound ↵Paul Thomas1-1/+1
character function) 2018-06-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/49630 * resolve.c (resolve_contained_fntype): Change standard ref. from F95 to F2003: C418. Correct a spelling error in a comment. It is an error for an abstract interface to have an assumed character length result. * trans-expr.c (gfc_conv_procedure_call): Likewise change the standard reference. 2018-06-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/49630 * gfortran.dg/assumed_charlen_function_7.f90: New test. From-SVN: r261868
2018-06-21re PR fortran/83118 (Bad intrinsic assignment of class(*) array component of ↵Paul Thomas1-0/+4
derived type) 2018-06-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/83118 * resolve.c (resolve_ordinary_assign): Force the creation of a vtable for assignment of non-polymorphic expressions to an unlimited polymorphic object. * trans-array.c (gfc_alloc_allocatable_for_assignment): Use the size of the rhs type for such assignments. Set the dtype, _len and vptrs appropriately. * trans-expr.c (gfc_trans_assignment): Force the use of the _copy function for these assignments. 2018-06-21 Paul Thomas <pault@gcc.gnu.org> PR fortran/83118 * gfortran.dg/unlimited_polymorphic_30.f03: New test. From-SVN: r261857
2018-06-10gfortran.h (gfc_expr): Add no_bounds_check field.Thomas Koenig1-0/+3
2018-06-10 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.h (gfc_expr): Add no_bounds_check field. * frontend-passes.c (get_array_inq_function): Set no_bounds_check on function and function argument. (inline_matmul_assign): Set no_bounds_check on zero expression and on lhs of zero expression. Also handle A1B2 case if realloc on assigment is active. * trans-array.c (gfc_conv_array_ref): Don't do range checking if expr has no_bounds_check set. (gfc_conv_expr_descriptor): Set no_bounds_check on ss if expr has it set. * trans-expr.c (gfc_trans_assignment_1): Set no_bounds_check on lss and lss if the corresponding expressions have it set. 2018-06-10 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.dg/inline_matmul_23.f90: New test. From-SVN: r261388