aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
AgeCommit message (Collapse)AuthorFilesLines
2023-06-11Daily bump.GCC Administrator1-0/+9
2023-06-10Fortran: add Fortran 2018 IEEE_{MIN,MAX} functionsFrancois-Xavier Coudert3-0/+133
libgfortran/ * ieee/ieee_arithmetic.F90: Add IEEE_MIN_NUM, IEEE_MAX_NUM, IEEE_MIN_NUM_MAG, and IEEE_MAX_NUM_MAG functions. gcc/fortran/ * f95-lang.cc (gfc_init_builtin_functions): Add fmax() and fmin() built-ins, and their variants. * mathbuiltins.def: Add FMAX and FMIN built-ins. * trans-intrinsic.cc (conv_intrinsic_ieee_minmax): New function. (gfc_conv_ieee_arithmetic_function): Handle IEEE_MIN_NUM and IEEE_MAX_NUM functions. gcc/testsuite/ * gfortran.dg/ieee/minmax_1.f90: New test.
2023-06-10Daily bump.GCC Administrator1-0/+7
2023-06-09fortran: Fix ICE on pr96024.f90 on big-endian hosts [PR96024]Jakub Jelinek1-1/+2
The pr96024.f90 testcase ICEs on big-endian hosts. The problem is that length->val.integer is accessed after checking length->expr_type == EXPR_CONSTANT, but it is a CHARACTER constant which uses length->val.character union member instead and on big-endian we end up reading constant 0x100000000 rather than some small number on little-endian and if target doesn't have enough memory for 4 times that (i.e. 16GB allocation), it ICEs. 2023-06-09 Jakub Jelinek <jakub@redhat.com> PR fortran/96024 * primary.cc (gfc_convert_to_structure_constructor): Only do constant string ctor length verification and truncation/padding if constant length has INTEGER type.
2023-06-09Daily bump.GCC Administrator1-0/+23
2023-06-08Fortran: Fix some more blockers in associate meta-bug [PR87477]Paul Thomas6-16/+33
2023-06-08 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/87477 PR fortran/99350 PR fortran/107821 PR fortran/109451 * decl.cc (char_len_param_value): Simplify a copy of the expr and replace the original if there is no error. * gfortran.h : Remove the redundant field 'rankguessed' from 'gfc_association_list'. * resolve.cc (resolve_assoc_var): Remove refs to 'rankguessed'. (resolve_variable): Associate names with constant or structure constructor targets cannot have array refs. * trans-array.cc (gfc_conv_expr_descriptor): Guard expression character length backend decl before using it. Suppress the assignment if lhs equals rhs. * trans-io.cc (gfc_trans_transfer): Scalarize transfer of associate variables pointing to a variable. Add comment. * trans-stmt.cc (trans_associate_var): Remove requirement that the character length be deferred before assigning the value returned by gfc_conv_expr_descriptor. Also, guard the backend decl before testing with VAR_P. gcc/testsuite/ PR fortran/99350 * gfortran.dg/pr99350.f90 : New test. PR fortran/107821 * gfortran.dg/associate_5.f03 : Changed error message. * gfortran.dg/pr107821.f90 : New test. PR fortran/109451 * gfortran.dg/associate_61.f90 : New test
2023-06-07Daily bump.GCC Administrator1-0/+20
2023-06-06openmp: Add support for the 'present' modifierTobias Burnus4-14/+137
This implements support for the OpenMP 5.1 'present' modifier, which can be used in map clauses in the 'target', 'target data', 'target data enter' and 'target data exit' constructs, and in the 'to' and 'from' clauses of the 'target update' construct. It is also supported in defaultmap. The modifier triggers a fatal runtime error if the data specified by the clause is not already present on the target device. It can also be combined with 'always' in map clauses. 2023-06-06 Kwok Cheung Yeung <kcy@codesourcery.com> Tobias Burnus <tobias@codesourcery.com> gcc/c/ * c-parser.cc (c_parser_omp_clause_defaultmap, c_parser_omp_clause_map): Parse 'present'. (c_parser_omp_clause_to, c_parser_omp_clause_from): Remove. (c_parser_omp_clause_from_to): New; parse to/from clauses with optional present modifer. (c_parser_omp_all_clauses): Update call. (c_parser_omp_target_data, c_parser_omp_target_enter_data, c_parser_omp_target_exit_data): Handle new map enum values for 'present' mapping. gcc/cp/ * parser.cc (cp_parser_omp_clause_defaultmap, cp_parser_omp_clause_map): Parse 'present'. (cp_parser_omp_clause_from_to): New; parse to/from clauses with optional 'present' modifier. (cp_parser_omp_all_clauses): Update call. (cp_parser_omp_target_data, cp_parser_omp_target_enter_data, cp_parser_omp_target_exit_data): Handle new enum value for 'present' mapping. * semantics.cc (finish_omp_target): Likewise. gcc/fortran/ * dump-parse-tree.cc (show_omp_namelist): Display 'present' map modifier. (show_omp_clauses): Display 'present' motion modifier for 'to' and 'from' clauses. * gfortran.h (enum gfc_omp_map_op): Add entries with 'present' modifiers. (struct gfc_omp_namelist): Add 'present_modifer'. * openmp.cc (gfc_match_motion_var_list): New, handles optional 'present' modifier for to/from clauses. (gfc_match_omp_clauses): Call it for to/from clauses; parse 'present' in defaultmap and map clauses. (resolve_omp_clauses): Allow 'present' modifiers on 'target', 'target data', 'target enter' and 'target exit' directives. * trans-openmp.cc (gfc_trans_omp_clauses): Apply 'present' modifiers to tree node for 'map', 'to' and 'from' clauses. Apply 'present' for defaultmap. gcc/ * gimplify.cc (omp_notice_variable): Apply GOVD_MAP_ALLOC_ONLY flag and defaultmap flags if the defaultmap has GOVD_MAP_FORCE_PRESENT flag set. (omp_get_attachment): Handle map clauses with 'present' modifier. (omp_group_base): Likewise. (gimplify_scan_omp_clauses): Reorder present maps to come first. Set GOVD flags for present defaultmaps. (gimplify_adjust_omp_clauses_1): Set map kind for present defaultmaps. * omp-low.cc (scan_sharing_clauses): Handle 'always, present' map clauses. (lower_omp_target): Handle map clauses with 'present' modifier. Handle 'to' and 'from' clauses with 'present'. * tree-core.h (enum omp_clause_defaultmap_kind): Add OMP_CLAUSE_DEFAULTMAP_PRESENT defaultmap kind. * tree-pretty-print.cc (dump_omp_clause): Handle 'map', 'to' and 'from' clauses with 'present' modifier. Handle present defaultmap. * tree.h (OMP_CLAUSE_MOTION_PRESENT): New #define. include/ * gomp-constants.h (GOMP_MAP_FLAG_SPECIAL_5): New. (GOMP_MAP_FLAG_FORCE): Redefine. (GOMP_MAP_FLAG_PRESENT, GOMP_MAP_FLAG_ALWAYS_PRESENT): New. (enum gomp_map_kind): Add map kinds with 'present' modifiers. (GOMP_MAP_COPY_TO_P, GOMP_MAP_COPY_FROM_P): Evaluate to true for map variants with 'present' (GOMP_MAP_ALWAYS_TO_P, GOMP_MAP_ALWAYS_FROM_P): Evaluate to true for map variants with 'always, present' modifiers. (GOMP_MAP_ALWAYS): Redefine. (GOMP_MAP_FORCE_P, GOMP_MAP_PRESENT_P): New. libgomp/ * libgomp.texi (OpenMP 5.1 Impl. status): Set 'present' support for defaultmap to 'Y', add 'Y' entry for 'present' on to/from/map clauses. * target.c (gomp_to_device_kind_p): Add map kinds with 'present' modifier. (gomp_map_vars_existing): Use new GOMP_MAP_FORCE_P macro. (gomp_map_vars_internal, gomp_update, gomp_target_rev): Emit runtime error if memory region not present. * testsuite/libgomp.c-c++-common/target-present-1.c: New test. * testsuite/libgomp.c-c++-common/target-present-2.c: New test. * testsuite/libgomp.c-c++-common/target-present-3.c: New test. * testsuite/libgomp.fortran/target-present-1.f90: New test. * testsuite/libgomp.fortran/target-present-2.f90: New test. * testsuite/libgomp.fortran/target-present-3.f90: New test. gcc/testsuite/ * c-c++-common/gomp/map-6.c: Update dg-error, extend to test for duplicated 'present' and extend scan-dump tests for 'present'. * gfortran.dg/gomp/defaultmap-1.f90: Update dg-error. * gfortran.dg/gomp/map-7.f90: Extend parse and dump test for 'present'. * gfortran.dg/gomp/map-8.f90: Extend for duplicate 'present' modifier checking. * c-c++-common/gomp/defaultmap-4.c: New test. * c-c++-common/gomp/map-9.c: New test. * c-c++-common/gomp/target-update-1.c: New test. * gfortran.dg/gomp/defaultmap-8.f90: New test. * gfortran.dg/gomp/map-11.f90: New test. * gfortran.dg/gomp/map-12.f90: New test. * gfortran.dg/gomp/target-update-1.f90: New test.
2023-06-03Daily bump.GCC Administrator1-0/+18
2023-06-02Fortran: fix diagnostics for SELECT RANK [PR100607]Steve Kargl1-6/+4
gcc/fortran/ChangeLog: PR fortran/100607 * resolve.cc (resolve_select_rank): Remove duplicate error. (resolve_fl_var_and_proc): Prevent NULL pointer dereference and suppress error message for temporary. gcc/testsuite/ChangeLog: PR fortran/100607 * gfortran.dg/select_rank_6.f90: New test.
2023-06-02Fortran: Fix some problems blocking associate meta-bug [PR87477]Paul Thomas2-28/+36
2023-06-02 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/87477 * parse.cc (parse_associate): Replace the existing evaluation of the target rank with calls to gfc_resolve_ref and gfc_expression_rank. Identify untyped target function results with structure constructors by finding the appropriate derived type. * resolve.cc (resolve_symbol): Allow associate variables to be assumed shape. gcc/testsuite/ PR fortran/87477 * gfortran.dg/associate_54.f90 : Cope with extra error. PR fortran/102109 * gfortran.dg/pr102109.f90 : New test. PR fortran/102112 * gfortran.dg/pr102112.f90 : New test. PR fortran/102190 * gfortran.dg/pr102190.f90 : New test. PR fortran/102532 * gfortran.dg/pr102532.f90 : New test. PR fortran/109948 * gfortran.dg/pr109948.f90 : New test. PR fortran/99326 * gfortran.dg/pr99326.f90 : New test.
2023-06-02Daily bump.GCC Administrator1-0/+13
2023-06-01Fortran: force error on bad KIND specifier [PR88552]Harald Anlauf1-0/+4
gcc/fortran/ChangeLog: PR fortran/88552 * decl.cc (gfc_match_kind_spec): Use error path on missing right parenthesis. (gfc_match_decl_type_spec): Use error return when an error occurred during matching a KIND specifier. gcc/testsuite/ChangeLog: PR fortran/88552 * gfortran.dg/pr88552.f90: New test.
2023-06-01OpenMP/Fortran: Permit pure directives inside PURETobias Burnus1-15/+35
Update permitted directives for directives marked in OpenMP's 5.2 as pure. To ensure that list is updated, unimplemented directives are placed into pure-2.f90 such the test FAILs once a known to be pure directive is implemented without handling its pureness. gcc/fortran/ChangeLog: * parse.cc (decode_omp_directive): Accept all pure directives inside a PURE procedures; handle 'error at(execution). libgomp/ChangeLog: * libgomp.texi (OpenMP 5.2): Mark pure-directive handling as 'Y'. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/nothing-2.f90: Remove one dg-error. * gfortran.dg/gomp/pr79154-2.f90: Update expected dg-error wording. * gfortran.dg/gomp/pr79154-simd.f90: Likewise. * gfortran.dg/gomp/pure-1.f90: New test. * gfortran.dg/gomp/pure-2.f90: New test. * gfortran.dg/gomp/pure-3.f90: New test. * gfortran.dg/gomp/pure-4.f90: New test.
2023-05-27Daily bump.GCC Administrator1-0/+36
2023-05-26Fortran/OpenMP: Add parsing support for allocators/allocate directivesTobias Burnus10-35/+529
gcc/fortran/ChangeLog: * dump-parse-tree.cc (show_omp_namelist): Update allocator, fix align dump. (show_omp_node, show_code_node): Handle EXEC_OMP_ALLOCATE. * gfortran.h (enum gfc_statement): Add ST_OMP_ALLOCATE and ..._EXEC. (enum gfc_exec_op): Add EXEC_OMP_ALLOCATE. (struct gfc_omp_namelist): Add 'allocator' to 'u2' union. (struct gfc_namespace): Add omp_allocate. (gfc_resolve_omp_allocate): New. * match.cc (gfc_free_omp_namelist): Free 'u2.allocator'. * match.h (gfc_match_omp_allocate, gfc_match_omp_allocators): New. * openmp.cc (gfc_omp_directives): Uncomment allocate/allocators. (gfc_match_omp_variable_list): Add bool arg for rejecting listening common-block vars separately. (gfc_match_omp_clauses): Update for u2.allocators. (OMP_ALLOCATORS_CLAUSES, gfc_match_omp_allocate, gfc_match_omp_allocators, is_predefined_allocator, gfc_resolve_omp_allocate): New. (resolve_omp_clauses): Update 'allocate' clause checks. (omp_code_to_statement, gfc_resolve_omp_directive): Handle OMP ALLOCATE/ALLOCATORS. * parse.cc (in_exec_part): New global var. (check_omp_allocate_stmt, parse_openmp_allocate_block): New. (decode_omp_directive, case_exec_markers, case_omp_decl, gfc_ascii_statement, parse_omp_structured_block): Handle OMP allocate/allocators. (verify_st_order, parse_executable): Set in_exec_part. * resolve.cc (gfc_resolve_blocks, resolve_codes): Handle allocate/allocators. * st.cc (gfc_free_statement): Likewise. * trans.cc (trans_code): Likewise. * trans-openmp.cc (gfc_trans_omp_directive): Likewise. (gfc_trans_omp_clauses, gfc_split_omp_clauses): Update for u2.allocator, fix for u.align. libgomp/ChangeLog: * testsuite/libgomp.fortran/allocate-4.f90: Update dg-error. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/allocate-2.f90: Update dg-error. * gfortran.dg/gomp/allocate-4.f90: New test. * gfortran.dg/gomp/allocate-5.f90: New test. * gfortran.dg/gomp/allocate-6.f90: New test. * gfortran.dg/gomp/allocate-7.f90: New test. * gfortran.dg/gomp/allocators-1.f90: New test. * gfortran.dg/gomp/allocators-2.f90: New test.
2023-05-25Daily bump.GCC Administrator1-0/+19
2023-05-24Fortran: reject bad DIM argument of SIZE intrinsic in simplification [PR104350]Harald Anlauf1-1/+11
gcc/fortran/ChangeLog: PR fortran/104350 * simplify.cc (simplify_size): Reject DIM argument of intrinsic SIZE with error when out of valid range. gcc/testsuite/ChangeLog: PR fortran/104350 * gfortran.dg/size_dim_2.f90: New test.
2023-05-24Fortran: checking and simplification of RESHAPE intrinsic [PR103794]Harald Anlauf4-6/+28
gcc/fortran/ChangeLog: PR fortran/103794 * check.cc (gfc_check_reshape): Expand constant arguments SHAPE and ORDER before checking. * gfortran.h (gfc_is_constant_array_expr): Add prototype. * iresolve.cc (gfc_resolve_reshape): Expand constant argument SHAPE. * simplify.cc (is_constant_array_expr): If array is determined to be constant, expand small array constructors if needed. (gfc_is_constant_array_expr): Wrapper for is_constant_array_expr. (gfc_simplify_reshape): Fix check for insufficient elements in SOURCE when no padding specified. gcc/testsuite/ChangeLog: PR fortran/103794 * gfortran.dg/reshape_10.f90: New test. * gfortran.dg/reshape_11.f90: New test.
2023-05-24Daily bump.GCC Administrator1-0/+17
2023-05-23Fortran: Fix assumed length chars and len inquiry [PR103716]Paul Thomas2-1/+5
2023-05-23 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/103716 * resolve.cc (gfc_resolve_ref): Conversion of array_ref into an element should be done for all characters without a len expr, not just deferred lens, and for integer expressions. * trans-expr.cc (conv_inquiry): For len and kind inquiry refs, set the se string_length to NULL_TREE. gcc/testsuite/ PR fortran/103716 * gfortran.dg/pr103716.f90 : New test.
2023-05-23Fortran: Allow declaration of finalizable DT in a submodule [PR97122]Paul Thomas1-6/+7
2023-05-23 Paul Thomas <pault@gcc.gnu.org> Steven G. Kargl <kargl@gcc.gnu.org> gcc/fortran PR fortran/97122 * decl.cc (variable_decl): Clean up white space issues. (gfc_match_final_decl): Declaration of finalizable derived type is allowed in a submodule. gcc/testsuite/ PR fortran/97122 * gfortran.dg/finalize_8.f03 : Replace testcase that checks declaration of finalizable derived types in submodules works.
2023-05-20Daily bump.GCC Administrator1-0/+8
2023-05-19fortran: Use CLASS_DATA from gfortran.hBernhard Reutner-Fischer3-16/+16
gcc/fortran/ChangeLog: * expr.cc (gfc_get_corank): Use CLASS_DATA from gfortran.h. * resolve.cc (resolve_component): Same. (resolve_fl_derived0): Same. * simplify.cc (gfc_simplify_extends_type_of): Same. (simplify_cobound): Same.
2023-05-19Daily bump.GCC Administrator1-0/+99
2023-05-18fortran: use _P() defines from tree.hBernhard Reutner-Fischer8-20/+19
gcc/fortran/ChangeLog: * trans-array.cc (is_pointer_array): Use _P() defines from tree.h. (gfc_conv_scalarized_array_ref): Ditto. (gfc_conv_array_ref): Ditto. * trans-decl.cc (gfc_finish_decl): Ditto. (gfc_get_symbol_decl): Ditto. * trans-expr.cc (gfc_trans_pointer_assignment): Ditto. (gfc_trans_arrayfunc_assign): Ditto. (gfc_trans_assignment_1): Ditto. * trans-intrinsic.cc (gfc_conv_intrinsic_minmax): Ditto. (conv_intrinsic_ieee_value): Ditto. * trans-io.cc (gfc_convert_array_to_string): Ditto. * trans-openmp.cc (gfc_omp_is_optional_argument): Ditto. (gfc_trans_omp_clauses): Ditto. * trans-stmt.cc (gfc_conv_label_variable): Ditto. * trans.cc (gfc_build_addr_expr): Ditto. (get_array_span): Ditto.
2023-05-18Fortran: Narrow return types [PR78798]Bernhard Reutner-Fischer21-103/+91
gcc/fortran/ChangeLog: PR fortran/78798 * array.cc (compare_bounds): Use narrower return type. (gfc_compare_array_spec): Likewise. (is_constant_element): Likewise. (gfc_constant_ac): Likewise. * check.cc (dim_rank_check): Likewise. * cpp.cc (gfc_cpp_init_options): Likewise. (dump_macro): Likewise. * cpp.h (gfc_cpp_handle_option): Likewise. * dependency.cc (gfc_ref_needs_temporary_p): Likewise. (gfc_check_argument_dependency): Likewise. (gfc_check_fncall_dependency): Likewise. (ref_same_as_full_array): Likewise. * dependency.h (gfc_check_fncall_dependency): Likewise. (gfc_dep_resolver): Likewise. (gfc_are_equivalenced_arrays): Likewise. * expr.cc (gfc_copy_ref): Likewise. (gfc_kind_max): Likewise. (numeric_type): Likewise. * gfortran.h (gfc_at_end): Likewise. (gfc_at_eof): Likewise. (gfc_at_bol): Likewise. (gfc_at_eol): Likewise. (gfc_define_undef_line): Likewise. (gfc_wide_is_printable): Likewise. (gfc_wide_is_digit): Likewise. (gfc_wide_fits_in_byte): Likewise. (gfc_find_sym_tree): Likewise. (gfc_generic_intrinsic): Likewise. (gfc_specific_intrinsic): Likewise. (gfc_intrinsic_actual_ok): Likewise. (gfc_has_vector_index): Likewise. (gfc_numeric_ts): Likewise. (gfc_impure_variable): Likewise. (gfc_pure): Likewise. (gfc_implicit_pure): Likewise. (gfc_elemental): Likewise. (gfc_pure_function): Likewise. (gfc_implicit_pure_function): Likewise. (gfc_compare_array_spec): Likewise. (gfc_constant_ac): Likewise. (gfc_expanded_ac): Likewise. (gfc_check_digit): Likewise. * intrinsic.cc (gfc_find_subroutine): Likewise. (gfc_generic_intrinsic): Likewise. (gfc_specific_intrinsic): Likewise. * io.cc (compare_to_allowed_values): Likewise. And remove unneeded forward declaration. * parse.cc: Likewise. * parse.h (gfc_check_do_variable): Likewise. * primary.cc (gfc_check_digit): Likewise. * resolve.cc (resolve_structure_cons): Likewise. (pure_stmt_function): Likewise. (gfc_pure_function): Likewise. (impure_stmt_fcn): Likewise. (resolve_forall_iterators): Likewise. (resolve_data): Likewise. (gfc_impure_variable): Likewise. (gfc_pure): Likewise. (gfc_unset_implicit_pure): Likewise. * scanner.cc (wide_is_ascii): Likewise. (gfc_wide_toupper): Likewise. (gfc_open_included_file): Likewise. (gfc_at_end): Likewise. (gfc_at_eof): Likewise. (gfc_at_bol): Likewise. (skip_comment_line): Likewise. (gfc_gobble_whitespace): Likewise. * symbol.cc (gfc_find_symtree_in_proc): Likewise. * trans-array.cc: Likewise. * trans-decl.cc (gfc_set_decl_assembler_name): Likewise. * trans-types.cc (gfc_get_element_type): Likewise. (gfc_add_field_to_struct): Likewise. * trans-types.h (gfc_copy_dt_decls_ifequal): Likewise. (gfc_return_by_reference): Likewise. (gfc_is_nodesc_array): Likewise. * trans.h (gfc_can_put_var_on_stack): Likewise.
2023-05-18Daily bump.GCC Administrator1-0/+17
2023-05-17Fortran: set shape of initializers of zero-sized arrays [PR95374,PR104352]Harald Anlauf1-2/+1
gcc/fortran/ChangeLog: PR fortran/95374 PR fortran/104352 * decl.cc (add_init_expr_to_sym): Set shape of initializer also for zero-sized arrays, so that bounds violations can be detected later. gcc/testsuite/ChangeLog: PR fortran/95374 PR fortran/104352 * gfortran.dg/zero_sized_13.f90: New test.
2023-05-17Fortran/OpenMP: Fix mapping of array descriptors and deferred-length stringsTobias Burnus2-91/+247
Previously, array descriptors might have been mapped as 'alloc' instead of 'to' for 'alloc', not updating the array bounds. The 'alloc' could also appear for 'data exit', failing with a libgomp assert. In some cases, either array descriptors or deferred-length string's length variable was not mapped. And, finally, some offset calculations with array-sections mappings went wrong. Additionally, the patch now unmaps for scalar allocatables/pointers the GOMP_MAP_POINTER, avoiding stale mappings. The testcases contain some comment-out tests which require follow-up work and for which PR exist. Those mostly relate to deferred-length strings which have several issues beyong OpenMP support. gcc/fortran/ChangeLog: * trans-decl.cc (gfc_get_symbol_decl): Add attributes such as 'declare target' also to hidden artificial variable for deferred-length character variables. * trans-openmp.cc (gfc_trans_omp_array_section, gfc_trans_omp_clauses, gfc_trans_omp_target_exit_data): Improve mapping of array descriptors and deferred-length string variables. gcc/ChangeLog: * gimplify.cc (gimplify_scan_omp_clauses): Remove Fortran special case. libgomp/ChangeLog: * testsuite/libgomp.fortran/target-enter-data-3.f90: Uncomment 'target exit data'. * testsuite/libgomp.fortran/target-enter-data-4.f90: New test. * testsuite/libgomp.fortran/target-enter-data-5.f90: New test. * testsuite/libgomp.fortran/target-enter-data-6.f90: New test. * testsuite/libgomp.fortran/target-enter-data-7.f90: New test. gcc/testsuite/ * gfortran.dg/goacc/finalize-1.f: Update dg-tree; shows a fix for 'finalize' as a ptr is now 'delete' instead of 'release'. * gfortran.dg/gomp/pr78260-2.f90: Likewise as elem-size calc moved to if (allocated) block * gfortran.dg/gomp/target-exit-data.f90: Likewise as a var is now a replaced by a MEM< _25 > expression. * gfortran.dg/gomp/map-9.f90: Update dg-scan-tree-dump. * gfortran.dg/gomp/map-10.f90: New test.
2023-05-17Daily bump.GCC Administrator1-0/+35
2023-05-16Fortran: Fix an assortment of bugsPaul Thomas4-54/+69
2023-05-16 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/105152 * interface.cc (gfc_compare_actual_formal): Emit an error if an unlimited polymorphic actual is not matched either to an unlimited or assumed type formal argument. PR fortran/100193 * resolve.cc (resolve_ordinary_assign): Emit an error if the var expression of an ordinary assignment is a proc pointer component. PR fortran/87496 * trans-array.cc (gfc_walk_array_ref): Provide assumed shape arrays coming from interface mapping with a viable arrayspec. PR fortran/103389 * trans-expr.cc (gfc_conv_intrinsic_to_class): Tidy up flagging of unlimited polymorphic 'class_ts'. (gfc_conv_gfc_desc_to_cfi_desc): Assumed type is unlimited polymorphic and should accept any actual type. PR fortran/104429 (gfc_conv_procedure_call): Replace dreadful kludge with a call to gfc_finalize_tree_expr. Avoid dereferencing a void pointer by giving it the pointer type of the actual argument. PR fortran/82774 (alloc_scalar_allocatable_subcomponent): Shorten the function name and replace the symbol argument with the se string length. If a deferred length character length is either not present or is not a variable, give the typespec a variable and assign the string length to that. Use gfc_deferred_strlen to find the hidden string length component. (gfc_trans_subcomponent_assign): Convert the expression before the call to alloc_scalar_allocatable_subcomponent so that a good string length is provided. (gfc_trans_structure_assign): Remove the unneeded derived type symbol from calls to gfc_trans_subcomponent_assign. gcc/testsuite/ PR fortran/105152 * gfortran.dg/pr105152.f90 : New test PR fortran/100193 * gfortran.dg/pr100193.f90 : New test PR fortran/87946 * gfortran.dg/pr87946.f90 : New test PR fortran/103389 * gfortran.dg/pr103389.f90 : New test PR fortran/104429 * gfortran.dg/pr104429.f90 : New test PR fortran/82774 * gfortran.dg/pr82774.f90 : New test
2023-05-16Daily bump.GCC Administrator1-0/+7
2023-05-15Fortran: CLASS pointer function result in variable definition context [PR109846]Harald Anlauf1-1/+1
gcc/fortran/ChangeLog: PR fortran/109846 * expr.cc (gfc_check_vardef_context): Check appropriate pointer attribute for CLASS vs. non-CLASS function result in variable definition context. gcc/testsuite/ChangeLog: PR fortran/109846 * gfortran.dg/ptr-func-5.f90: New test.
2023-05-12Daily bump.GCC Administrator1-0/+4
2023-05-11fortran: use grep instead of fgrepXi Ruoyao1-1/+1
fgrep has been deprecated in favor of grep -F for a long time, and the curren grep release (3.10) prints a warning of fgrep is used. Stop using fgrep so we won't see the warning. We can't hard code grep -F here or it may break build on hosts w/o GNU grep. autoconf documentation contains a warning about this issue and suggest to use AC_PROG_FGREP and $FGREP, but these are too overkill in the specific case: there is no way "debian" could be interpreted as an non-trivial regex, so we can use a plain grep here. gcc/fortran/ChangeLog: * Make-lang.in: Use grep instead of fgrep.
2023-05-11Daily bump.GCC Administrator1-0/+13
2023-05-10Fortran: dump-parse-tree: Mark debug functions with DEBUG_FUNCTIONBernhard Reutner-Fischer1-16/+22
gcc/fortran/ChangeLog: * dump-parse-tree.cc (gfc_debug_expr): Remove forward declaration. (debug): Add DEBUG_FUNCTION. (show_code_node): Remove erroneous whitespace.
2023-05-10Fortran: dump-parse-tree attribs: fix unbalanced braces [PR109624]Bernhard Reutner-Fischer1-3/+13
gcc/fortran/ChangeLog: PR fortran/109624 * dump-parse-tree.cc (debug): New function for gfc_namespace. (gfc_debug_code): Delete forward declaration. (show_attr): Make sure to print balanced braces.
2023-05-09Daily bump.GCC Administrator1-0/+15
2023-05-08fortran: Fix coding style around free()Bernhard Reutner-Fischer1-1/+1
Fix coding-style errors introduced in ca2f64d5d08c1699ca4b7cb2bf6a76692e809e0f gcc/fortran/ChangeLog: * resolve.cc (resolve_select_type): Fix coding style. libgfortran/ChangeLog: * caf/single.c (_gfortran_caf_register): Fix coding style. * io/async.c (update_pdt, async_io): Likewise. * io/format.c (free_format_data): Likewise. * io/transfer.c (st_read_done_worker, st_write_done_worker): Likewise. * io/unix.c (mem_close): Likewise.
2023-05-08fortran: Remove conditionals around free()Bernhard Reutner-Fischer1-2/+1
gcc/fortran/ChangeLog: * resolve.cc (resolve_select_type): Call free() unconditionally. libgfortran/ChangeLog: * caf/single.c (_gfortran_caf_register): Call free() unconditionally. * io/async.c (update_pdt, async_io): Likewise. * io/format.c (free_format_data): Likewise. * io/transfer.c (st_read_done_worker, st_write_done_worker): Likewise. * io/unix.c (mem_close): Likewise.
2023-05-08Fortran: Fix mpz and mpfr memory leaks [PR fortran/68800]Bernhard Reutner-Fischer2-4/+9
gcc/fortran/ChangeLog: PR fortran/68800 * expr.cc (find_array_section): Fix mpz memory leak. * simplify.cc (gfc_simplify_reshape): Fix mpz memory leaks in error paths.
2023-05-06Daily bump.GCC Administrator1-0/+12
2023-05-05Fortran: overloading of intrinsic binary operators [PR109641]Harald Anlauf3-0/+44
Fortran allows overloading of intrinsic operators also for operands of numeric intrinsic types. The intrinsic operator versions are used according to the rules of F2018 table 10.2 and imply type conversion as long as the operand ranks are conformable. Otherwise no type conversion shall be performed to allow the resolution of a matching user-defined operator. gcc/fortran/ChangeLog: PR fortran/109641 * arith.cc (eval_intrinsic): Check conformability of ranks of operands for intrinsic binary operators before performing type conversions. * gfortran.h (gfc_op_rank_conformable): Add prototype. * resolve.cc (resolve_operator): Check conformability of ranks of operands for intrinsic binary operators before performing type conversions. (gfc_op_rank_conformable): New helper function to compare ranks of operands of binary operator. gcc/testsuite/ChangeLog: PR fortran/109641 * gfortran.dg/overload_5.f90: New test.
2023-05-05Daily bump.GCC Administrator1-0/+9
2023-05-04OpenACC: Further attach/detach clause fixes for Fortran [PR109622]Julian Brown2-2/+22
This patch moves several tests introduced by the following patch: https://gcc.gnu.org/pipermail/gcc-patches/2023-April/616939.html commit r14-325-gcacf65d74463600815773255e8b82b4043432bd7 into the proper location for OpenACC testing (thanks to Thomas for spotting my mistake!), and also fixes a few additional problems -- missing diagnostics for non-pointer attaches, and a case where a pointer was incorrectly dereferenced. Tests are also adjusted for vector-length warnings on nvidia accelerators. 2023-04-29 Julian Brown <julian@codesourcery.com> PR fortran/109622 gcc/fortran/ * openmp.cc (resolve_omp_clauses): Add diagnostic for non-pointer/non-allocatable attach/detach. * trans-openmp.cc (gfc_trans_omp_clauses): Remove dereference for pointer-to-scalar derived type component attach/detach. Fix attach/detach handling for descriptors. gcc/testsuite/ * gfortran.dg/goacc/pr109622-5.f90: New test. * gfortran.dg/goacc/pr109622-6.f90: New test. libgomp/ * testsuite/libgomp.fortran/pr109622.f90: Move test... * testsuite/libgomp.oacc-fortran/pr109622.f90: ...to here. Ignore vector length warning. * testsuite/libgomp.fortran/pr109622-2.f90: Move test... * testsuite/libgomp.oacc-fortran/pr109622-2.f90: ...to here. Add missing copyin/copyout variable. Ignore vector length warnings. * testsuite/libgomp.fortran/pr109622-3.f90: Move test... * testsuite/libgomp.oacc-fortran/pr109622-3.f90: ...to here. Ignore vector length warnings. * testsuite/libgomp.oacc-fortran/pr109622-4.f90: New test.
2023-04-29Daily bump.GCC Administrator1-0/+30
2023-04-28OpenACC: Stand-alone attach/detach clause fixes for Fortran [PR109622]Julian Brown1-3/+33
This patch fixes several cases where multiple attach or detach mapping nodes were being created for stand-alone attach or detach clauses in Fortran. After the introduction of stricter checking later during compilation, these extra nodes could cause ICEs, as seen in the PR. The patch also fixes cases that "happened to work" previously where the user attaches/detaches a pointer to array using a descriptor, and (I think!) the "_data" field has offset zero, hence the same address as the descriptor as a whole. 2023-04-27 Julian Brown <julian@codesourcery.com> PR fortran/109622 gcc/fortran/ * trans-openmp.cc (gfc_trans_omp_clauses): Attach/detach clause fixes. gcc/testsuite/ * gfortran.dg/goacc/attach-descriptor.f90: Adjust expected output. libgomp/ * testsuite/libgomp.fortran/pr109622.f90: New test. * testsuite/libgomp.fortran/pr109622-2.f90: New test. * testsuite/libgomp.fortran/pr109622-3.f90: New test.
2023-04-28Fortran: Fix (mostly) comment typosTobias Burnus22-53/+53
Only other changes are fixing the variable name a(b)breviated_modproc_decl and a few typos in gfortran.texi. gcc/fortran/ChangeLog: * gfortran.texi: Fix typos. * decl.cc: Fix typos in comments and in a variable name. * arith.cc: Fix comment typos. * check.cc: Likewise. * class.cc: Likewise. * dependency.cc: Likewise. * expr.cc: Likewise. * frontend-passes.cc: Likewise. * gfortran.h: Likewise. * intrinsic.cc: Likewise. * iresolve.cc: Likewise. * match.cc: Likewise. * module.cc: Likewise. * primary.cc: Likewise. * resolve.cc: Likewise. * simplify.cc: Likewise. * trans-array.cc: Likewise. * trans-decl.cc: Likewise. * trans-expr.cc: Likewise. * trans-intrinsic.cc: Likewise. * trans-openmp.cc: Likewise. * trans-stmt.cc: Likewise.