aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
AgeCommit message (Collapse)AuthorFilesLines
2025-03-06Daily bump.GCC Administrator1-0/+11
2025-03-05Regenerate fortran/lang.opt.urlsMark Wielaard1-0/+3
fortran added a new -Wexternal-argument-mismatch option, but the lang.opt.urls file wasn't regenerated. Fixes: 21ca9153ebe5 ("C prototypes for external arguments; add warning for mismatch.") gcc/fortran/ChangeLog: * lang.opt.urls: Regenerated.
2025-03-05Fortran: Add view convert to pointer assign when only pointer/alloc attr ↵Andre Vehreschild1-1/+9
differs [PR104684] PR fortran/104684 gcc/fortran/ChangeLog: * trans-array.cc (gfc_conv_expr_descriptor): Look at the lang-specific akind and do a view convert when only the akind attribute differs between pointer and allocatable array. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/ptr_comp_6.f08: New test.
2025-03-05Daily bump.GCC Administrator1-0/+40
2025-03-04C prototypes for external arguments; add warning for mismatch.Thomas Koenig5-37/+162
The problem was that we were not handling external dummy arguments with -fc-prototypes-external. In looking at this, I found that we were not warning about external procedures with different argument lists. This can actually be legal (see the two test cases) but creates a problem for the C prototypes: If we have something like subroutine foo(a,n) external a if (n == 1) call a(1) if (n == 2) call a(2,3) end subroutine foo then, pre-C23, we could just have written out the prototype as void foo_ (void (*a) (), int *n); but this is illegal in C23. What to do? I finally chose to warn about the argument mismatch, with a new option. Warn only because the code above is legal, but include in -Wall because such code seems highly suspect. This option is also implied in -fc-prototypes-external. I also put a warning in the generated header file in that case, so users have a chance to see what is going on (especially since gcc now defaults to C23). gcc/fortran/ChangeLog: PR fortran/119049 PR fortran/119074 * dump-parse-tree.cc (seen_conflict): New static varaible. (gfc_dump_external_c_prototypes): Initialize it. If it was set, write out a warning that -std=c23 will not work. (write_proc): Move the work of actually writing out the formal arglist to... (write_formal_arglist): New function. Handle external dummy parameters and their argument lists. If there were mismatched arguments, output an empty argument list in pre-C23 style. * gfortran.h (struct gfc_symbol): Add ext_dummy_arglist_mismatch flag and formal_at. * invoke.texi: Document -Wexternal-argument-mismatch. * lang.opt: Put it in. * resolve.cc (resolve_function): If warning about external argument mismatches, build a formal from actual arglist the first time around, and later compare and warn. (resolve_call): Likewise gcc/testsuite/ChangeLog: PR fortran/119049 PR fortran/119074 * gfortran.dg/interface_55.f90: New test. * gfortran.dg/interface_56.f90: New test.
2025-03-04Fortran: Fix gimplification error on assignment to pointer [PR103391]Andre Vehreschild1-8/+8
PR fortran/103391 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_trans_assignment_1): Do not use poly assign for pointer arrays on lhs (as it is done for allocatables already). gcc/testsuite/ChangeLog: * gfortran.dg/assign_12.f90: New test.
2025-03-04Fortran: Prevent ICE when getting caf-token from abstract type [PR77872]Andre Vehreschild1-0/+5
PR fortran/77872 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_get_tree_for_caf_expr): Pick up token from decl when it is present there for class types. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/class_1.f90: New test.
2025-03-04Fortran: Reduce code complexity [PR77872]Andre Vehreschild1-11/+3
PR fortran/77872 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_conv_procedure_call): Use attr instead of doing type check and branching for BT_CLASS.
2025-03-04Daily bump.GCC Administrator1-0/+16
2025-03-03Fortran: reject empty derived type with bind(C) attribute [PR101577]Harald Anlauf1-3/+20
PR fortran/101577 gcc/fortran/ChangeLog: * symbol.cc (verify_bind_c_derived_type): Generate error message for derived type with no components in standard conformance mode, indicating that this is a GNU extension. gcc/testsuite/ChangeLog: * gfortran.dg/empty_derived_type.f90: Adjust dg-options. * gfortran.dg/empty_derived_type_2.f90: New test.
2025-03-03Fortran: Fix regression on double free on elemental function [PR118747]Andre Vehreschild2-10/+14
Fix a regression were adding a temporary variable inserted a copy of the argument to the elemental function. That copy was then later used to free allocated memory, but the freeing was not tracked in the source array correctly. PR fortran/118747 gcc/fortran/ChangeLog: * trans-array.cc (gfc_trans_array_ctor_element): Remove copy to temporary variable. * trans-expr.cc (gfc_conv_procedure_call): Use references to array members instead of copies when freeing after use. Formatting fix. gcc/testsuite/ChangeLog: * gfortran.dg/alloc_comp_auto_array_4.f90: New test.
2025-03-03Daily bump.GCC Administrator1-0/+31
2025-03-02Fortran: Small fixes in intrinsic.texi.Sandra Loosemore1-13/+13
gcc/fortran/ChangeLog * intrinsic.texi: Fix inconsistent capitalization of argument names and other minor copy-editing.
2025-03-02Fortran: Move "Standard" subheading in documentation [PR47928]Sandra Loosemore1-923/+923
As noted in the issue, the version of the standard an intrinsic was introduced in is usually not the second-most-important thing a user needs to know. This patch moves it from near the beginning of each section towards the end, just ahead of "See also". gcc/fortran/ChangeLog PR fortran/47928 * intrinsic.texi: Move the "Standard" subheading farther down.
2025-03-02Fortran: Rename/move "Syntax" subheading in documentation [PR47928]Sandra Loosemore2-1159/+1159
As suggested in the issue, it makes more sense to describe the function call argument syntax before talking about the arguments in the description. gcc/fortran/ChangeLog PR fortran/47928 * gfortran.texi: Move all the "Syntax" subheadings ahead of "Description", and rename to "Synopsis". * intrinsic.texi: Likewise.
2025-03-02Fortran: Whitespace cleanup in documentation [PR47928]Sandra Loosemore1-19/+15
This is a preparatory patch for the main changes requested in the issue. gcc/fortran/ChangeLog PR fortran/47928 * intrinsic.texi: Put a blank line between "@item @emph{}" subheadings, but not more than one.
2025-03-02Fortran: Tidy subheadings in Fortran documentation [PR47928]Sandra Loosemore2-49/+48
This is a preparatory patch for the main documentation changes requested in the issue. gcc/fortran/ChangeLog PR fortran/47928 * gfortran.texi: Consistently use "@emph{Notes}:" instead of other spellings. * intrinsic.texi: Likewise. Also fix an inconsistent capitalization and remove a redundant "Standard" entry.
2025-03-02Daily bump.GCC Administrator1-0/+6
2025-03-01Fortran: fix front-end memleak after failure during parsing of NULLIFYHarald Anlauf2-0/+3
gcc/fortran/ChangeLog: * match.cc (gfc_match_nullify): Free matched expression when cleaning up. * primary.cc (match_variable): Initialize result to NULL.
2025-03-01Daily bump.GCC Administrator1-0/+6
2025-02-28Fortran: Ensure finalizer is called for unreferenced variable [PR118730]Andre Vehreschild1-0/+8
PR fortran/118730 gcc/fortran/ChangeLog: * resolve.cc: Mark unused derived type variable with finalizers referenced to execute finalizer when leaving scope. gcc/testsuite/ChangeLog: * gfortran.dg/class_array_15.f03: Remove unused variable. * gfortran.dg/coarray_poly_7.f90: Adapt scan-tree-dump expr. * gfortran.dg/coarray_poly_8.f90: Same. * gfortran.dg/finalize_60.f90: New test.
2025-02-28Daily bump.GCC Administrator1-0/+6
2025-02-27Fortran: Fix ICE on associate of pointer [PR118789]Andre Vehreschild1-1/+6
Fix ICE when associating a pointer to void (c_ptr) by looking at the compatibility of the type hierarchy. PR fortran/118789 gcc/fortran/ChangeLog: * trans-stmt.cc (trans_associate_var): Compare pointed to types when expr to associate is already a pointer. gcc/testsuite/ChangeLog: * gfortran.dg/associate_73.f90: New test.
2025-02-27Daily bump.GCC Administrator1-0/+5
2025-02-26Fortran: Remove SAVE_EXPR on lhs in assign [PR108233]Andre Vehreschild1-5/+8
With vectorial shaped datatypes like e.g. complex numbers, fold_convert inserts a SAVE_EXPR. Using that on the lhs in an assignment prevented the update of the variable, when in a coarray. PR fortran/108233 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_trans_assignment_1): Remove SAVE_EXPR on lhs. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/complex_1.f90: New test.
2025-02-26Daily bump.GCC Administrator1-0/+17
2025-02-25Fortran: Fix detection of descriptor arrays in coarray [PR107635]Andre Vehreschild2-11/+34
Look at the formal arguments generated type in the function declaration to figure if an argument is a descriptor arrays. Fix handling of class types while splitting coarray expressions. PR fortran/107635 gcc/fortran/ChangeLog: * coarray.cc (fixup_comp_refs): For class types set correct component (class) type. (split_expr_at_caf_ref): Provide location. * trans-intrinsic.cc (conv_caf_send_to_remote): Look at generated formal argument and not declared one to detect descriptor arrays. (conv_caf_sendget): Same.
2025-02-25Fortran: Use correct size when transferring between images [PR107635]Andre Vehreschild1-3/+6
gcc/fortran/ChangeLog: PR fortran/107635 * trans-intrinsic.cc (conv_caf_sendget): Use the size of data transferred between the two images and not the descritor's size.
2025-02-22Daily bump.GCC Administrator1-0/+20
2025-02-21Fortran: initialize non-saved pointers with -fcheck=pointer [PR48958]Harald Anlauf1-2/+5
PR fortran/48958 gcc/fortran/ChangeLog: * trans-array.cc (gfc_trans_deferred_array): Initialize the data component of non-saved pointers when -fcheck=pointer is set. gcc/testsuite/ChangeLog: * gfortran.dg/pointer_init_13.f90: New test.
2025-02-21Fortran: Improve gfc_array_kind for assumed rank; gfc_tree_array_size on 'tree'Tobias Burnus4-44/+90
Improve the internal and debug representation of assumed-rank arrays by honoring the pointer and allocatable property. Permit obtaining the array size from only a tree (via the array descriptor) besides obtaining it from the gfc_expr's array spec. This will be used by a follow up OpenMP patch for mapping derived types with allocatable components. gcc/fortran/ChangeLog: * trans-array.cc (gfc_full_array_size): Obtain the rank from the array descriptor for assumed rank. (gfc_tree_array_size): Likewise; permit expr = NULL to operate only the tree. (gfc_conv_descriptor_stride_get): Update for added assumed-rank array types. * trans-openmp.cc (gfc_omp_finish_clause): Likewise. * trans-types.cc (gfc_build_array_type, gfc_get_derived_type, gfc_get_array_descr_info): Likewise. * trans.h (enum gfc_array_kind): Add GFC_ARRAY_ASSUMED_RANK_{ALLOCATABLE,POINTER{,_CONT}}.
2025-02-21Daily bump.GCC Administrator1-0/+152
2025-02-20Fortran: Remove deprecated coarray routines [PR107635]Andre Vehreschild4-1494/+0
gcc/fortran/ChangeLog: PR fortran/107635 * gfortran.texi: Remove deprecated functions from documentation. * trans-decl.cc (gfc_build_builtin_function_decls): Remove decprecated function decls. * trans-intrinsic.cc (gfc_conv_intrinsic_exponent): Remove deprecated/no longer needed routines. * trans.h: Remove unused decls. libgfortran/ChangeLog: * caf/libcaf.h (_gfortran_caf_get): Removed because deprecated. (_gfortran_caf_send): Same. (_gfortran_caf_sendget): Same. (_gfortran_caf_send_by_ref): Same. * caf/single.c (assign_char4_from_char1): Same. (assign_char1_from_char4): Same. (convert_type): Same. (defined): Same. (_gfortran_caf_get): Same. (_gfortran_caf_send): Same. (_gfortran_caf_sendget): Same. (copy_data): Same. (get_for_ref): Same. (_gfortran_caf_get_by_ref): Same. (send_by_ref): Same. (_gfortran_caf_send_by_ref): Same. (_gfortran_caf_sendget_by_ref): Same.
2025-02-20Fortran: Add transfer_between_remotes [PR107635]Andre Vehreschild6-1071/+1433
Add the last missing coarray data manipulation routine using remote accessors. gcc/fortran/ChangeLog: PR fortran/107635 * coarray.cc (rewrite_caf_send): Rewrite to transfer_between_remotes when both sides of the assignment have a coarray. (coindexed_code_callback): Prevent duplicate rewrite. * gfortran.texi: Add documentation for transfer_between_remotes. * intrinsic.cc (add_subroutines): Add intrinsic symbol for caf_sendget to allow easy rewrite to transfer_between_remotes. * trans-decl.cc (gfc_build_builtin_function_decls): Add prototype for transfer_between_remotes. * trans-intrinsic.cc (conv_caf_vector_subscript_elem): Mark as deprecated. (conv_caf_vector_subscript): Same. (compute_component_offset): Same. (conv_expr_ref_to_caf_ref): Same. (conv_stat_and_team): Extract stat and team from expr. (gfc_conv_intrinsic_caf_get): Use conv_stat_and_team. (conv_caf_send_to_remote): Same. (has_ref_after_cafref): Mark as deprecated. (conv_caf_sendget): Translate to transfer_between_remotes. * trans.h: Add prototype for transfer_between_remotes. libgfortran/ChangeLog: * caf/libcaf.h: Add prototype for transfer_between_remotes. * caf/single.c: Implement transfer_between_remotes. gcc/testsuite/ChangeLog: * gfortran.dg/coarray_lib_comm_1.f90: Fix up scan_trees.
2025-02-20Fortran: Add send_to_remote [PR107635]Andre Vehreschild7-62/+641
Refactor to use send_to_remote instead of the slow send_by_ref. gcc/fortran/ChangeLog: PR fortran/107635 * coarray.cc (move_coarray_ref): Move the coarray reference out of the given one. Especially when there is a regular array ref. (fixup_comp_refs): Move components refs to a derived type where the codim has been removed, aka a new type. (split_expr_at_caf_ref): Correctly split the reference chain. (remove_caf_ref): Simplify. (create_get_callback): Fix some deficiencies. (create_allocated_callback): Adapt to new signature of split. (create_send_callback): New function. (rewrite_caf_send): Rewrite a call to caf_send to caf_send_to_remote. (coindexed_code_callback): Treat caf_send and caf_sendget correctly. * gfortran.h (enum gfc_isym_id): Add SENDGET-isym. * gfortran.texi: Add documentation for send_to_remote. * resolve.cc (gfc_resolve_code): No longer generate send_by_ref when allocatable coarray (component) is on the lhs. * trans-decl.cc (gfc_build_builtin_function_decls): Add caf_send_to_remote decl. * trans-intrinsic.cc (conv_caf_func_index): Ensure the static variables created are not in a block-scope. (conv_caf_send_to_remote): Translate caf_send_to_remote calls. (conv_caf_send): Renamed to conv_caf_sendget. (conv_caf_sendget): Renamed from conv_caf_send. (gfc_conv_intrinsic_subroutine): Branch correctly for conv_caf_send and sendget. * trans.h: Correct decl. libgfortran/ChangeLog: * caf/libcaf.h: Add/Correct prototypes for caf_get_from_remote, caf_send_to_remote. * caf/single.c (struct accessor_hash_t): Rename accessor_t to getter_t. (_gfortran_caf_register_accessor): Use new name of getter_t. (_gfortran_caf_send_to_remote): New function for sending data to coarray on a remote image. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/send_char_array_1.f90: Extend test to catch more cases. * gfortran.dg/coarray_42.f90: Invert tests use, because no longer a send is needed when local memory in a coarray is allocated.
2025-02-20Fortran: Add caf_is_present_on_remote. [PR107635]Andre Vehreschild7-84/+264
Replace caf_is_present by caf_is_present_on_remote which is using a dedicated callback for each object to test on the remote image. gcc/fortran/ChangeLog: PR fortran/107635 * coarray.cc (create_allocated_callback): Add creating remote side procedure for checking allocation status of coarray. (rewrite_caf_allocated): Rewrite ALLOCATED on coarray to use caf routine. (coindexed_expr_callback): Exempt caf_is_present_on_remote from being rewritten again. * gfortran.h (enum gfc_isym_id): Add caf_is_present_on_remote id. * gfortran.texi: Add documentation for caf_is_present_on_remote. * intrinsic.cc (add_functions): Add caf_is_present_on_remote symbol. * trans-decl.cc (gfc_build_builtin_function_decls): Define interface of caf_is_present_on_remote. * trans-intrinsic.cc (gfc_conv_intrinsic_caf_is_present_remote): Translate caf_is_present_on_remote. (trans_caf_is_present): Remove. (caf_this_image_ref): Remove. (gfc_conv_allocated): Take out coarray treatment, because that is rewritten to caf_is_present_on_remote now. (gfc_conv_intrinsic_function): Handle caf_is_present_on_remote calls. * trans.h: Add symbol for caf_is_present_on_remote and remove old one. libgfortran/ChangeLog: * caf/libcaf.h (_gfortran_caf_is_present_on_remote): Add new function. (_gfortran_caf_is_present): Remove deprecated one. * caf/single.c (struct accessor_hash_t): Add function ptr access for remote side call. (_gfortran_caf_is_present_on_remote): Added. (_gfortran_caf_is_present): Removed. gcc/testsuite/ChangeLog: * gfortran.dg/coarray/coarray_allocated.f90: Adapt to new method of checking on remote image. * gfortran.dg/coarray_lib_alloc_4.f90: Same.
2025-02-20Fortran: Allow to use non-pure/non-elemental functions in coarray indexes ↵Andre Vehreschild2-140/+420
[PR107635] Extract calls to non-pure or non-elemental functions from index expressions on a coarray. gcc/fortran/ChangeLog: PR fortran/107635 * coarray.cc (get_arrayspec_from_expr): Treat array result of function calls correctly. (remove_coarray_from_derived_type): Prevent memory loss. (add_caf_get_from_remote): Correct locus. (find_comp): New function to find or create a new component in a derived type. (check_add_new_comp_handle_array): Handle allocatable arrays or non-pure/non-elemental functions in indexes of coarrays. (check_add_new_component): Use above function. (create_get_parameter_type): Rename to create_caf_add_data_parameter_type. (create_caf_add_data_parameter_type): Renaming of variable and make the additional data a coarray. (remove_caf_ref): Factor out to reuse in other caf-functions. (create_get_callback): Use function factored out, set locus correctly and ensure a kind is set for parameters. (add_caf_get_intrinsic): Rename to add_caf_get_from_remote and rename some variables. (coindexed_expr_callback): Skip over function created by the rewriter. (coindexed_code_callback): Filter some intrinsics not to process. (gfc_coarray_rewrite): Rewrite also contained functions. * trans-intrinsic.cc (gfc_conv_intrinsic_caf_get): Reflect changed order on caf_get_from_remote (). libgfortran/ChangeLog: * caf/libcaf.h (_gfortran_caf_register_accessor): Reflect changed parameter order. * caf/single.c (struct accessor_hash_t): Same. (_gfortran_caf_register_accessor): Call accessor using a token for accessing arrays with a descriptor on the source side. gcc/testsuite/ChangeLog: * gfortran.dg/coarray_lib_comm_1.f90: Adapt scan expression. * gfortran.dg/coarray/get_with_fn_parameter.f90: New test. * gfortran.dg/coarray/get_with_scalar_fn.f90: New test.
2025-02-20Fortran: Prepare for more caf-rework. [PR107635]Andre Vehreschild4-129/+149
Factor out generation of code to get remote function index and to create the additional data structure. Rename caf_get_by_ct to caf_get_from_remote. gcc/fortran/ChangeLog: PR fortran/107635 * gfortran.texi: Rename caf_get_by_ct to caf_get_from_remote. * trans-decl.cc (gfc_build_builtin_function_decls): Rename intrinsic. * trans-intrinsic.cc (conv_caf_func_index): Factor out functionality to be reused by other caf-functions. (conv_caf_add_call_data): Same. (gfc_conv_intrinsic_caf_get): Use functions factored out. * trans.h: Rename intrinsic symbol. libgfortran/ChangeLog: * caf/libcaf.h (_gfortran_caf_get_by_ref): Remove from ABI. This function is replaced by caf_get_from_remote (). (_gfortran_caf_get_remote_function_index): Use better name. * caf/single.c (_gfortran_caf_finalize): Free internal data. (_gfortran_caf_get_by_ref): Remove from public interface, but keep it, because it is still used by sendget (). gcc/testsuite/ChangeLog: * gfortran.dg/coarray_lib_comm_1.f90: Adapt to renamed ABI function. * gfortran.dg/coarray_stat_function.f90: Same. * gfortran.dg/coindexed_1.f90: Same.
2025-02-20Fortran: Move caf_get-rewrite to coarray.cc [PR107635]Andre Vehreschild5-698/+785
Add a rewriter to keep all expression tree that is not optimization together. At the moment this is just a move from resolve.cc, but will be extended to handle more cases where rewriting the expression tree may be easier. The first use case is to extract accessors for coarray remote image data access. gcc/fortran/ChangeLog: PR fortran/107635 * Make-lang.in: Add coarray.cc. * coarray.cc: New file. * gfortran.h (gfc_coarray_rewrite): New procedure. * parse.cc (rewrite_expr_tree): Add entrypoint for rewriting expression trees. * resolve.cc (gfc_resolve_ref): Remove caf_lhs handling. (get_arrayspec_from_expr): Moved to rewrite.cc. (remove_coarray_from_derived_type): Same. (convert_coarray_class_to_derived_type): Same. (split_expr_at_caf_ref): Same. (check_add_new_component): Same. (create_get_parameter_type): Same. (create_get_callback): Same. (add_caf_get_intrinsic): Same. (resolve_variable): Remove caf_lhs handling. libgfortran/ChangeLog: * caf/single.c (_gfortran_caf_finalize): Free memory preventing leaks. (_gfortran_caf_get_by_ct): Fix constness. * caf/libcaf.h (_gfortran_caf_register_accessor): Fix constness.
2025-02-18Daily bump.GCC Administrator1-0/+22
2025-02-17OpenMP/Fortran: extend 'adjust_args' clause, fixes for it and declare ↵Tobias Burnus4-85/+409
variant [PR115271] On the extension side, it implements OpenMP 6.0's numeric values/ranges for the adjust_args arguments, including 'omp_num_args'. And it adds parser support for need_device_addr. It also implements the post-OpenMP-6.0 clarification of OpenMP spec Issue #4443 regarding type(c_ptr) with dimension being invalid for need_device_ptr. To be done: Adding full support for need_device_addr (optional, array descriptor, ...). On the invalid side, it removed a bogus c_ptr check that went through all adjust_args without checking for need_device_ptr and the current scope. And it finally also processes 'declare variant' in an INTERFACE block, which is part of PR115271, but it does not handle .mod file yet - the main issue tracked in that PR. PR fortran/115271 gcc/fortran/ChangeLog: * gfortran.h (gfc_omp_namelist): Change need_device_ptr to adj_args union and add more flags. * openmp.cc (gfc_match_omp_declare_variant, gfc_resolve_omp_declare): For adjust_args, handle need_device_addr and numeric values/ranges besides dummy argument names. (resolve_omp_dispatch): Remove bogus a adjust_args check. * trans-decl.cc (gfc_handle_omp_declare_variant): New. (gfc_generate_module_vars, gfc_generate_function_code): Call it. * trans-openmp.cc (gfc_trans_omp_declare_variant): Handle numeric values/ranges besides dummy argument names. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/adjust-args-1.f90: Update dg-.* expectations. * gfortran.dg/gomp/adjust-args-2.f90: Likewise. * gfortran.dg/gomp/adjust-args-2a.f90: Likewise. * gfortran.dg/gomp/adjust-args-3.f90: Likewise. * gfortran.dg/gomp/adjust-args-4.f90: Remove array from c_ptr. * gfortran.dg/gomp/adjust-args-5.f90: Likewise. * gfortran.dg/gomp/adjust-args-11.f90: Likewise. Add check that INTERFACE is now handled in subroutines and in modules. * gfortran.dg/gomp/adjust-args-13.f90: New test. * gfortran.dg/gomp/adjust-args-14.f90: New test. * gfortran.dg/gomp/adjust-args-15.f90: New test. * gfortran.dg/gomp/declare-variant-21.f90: New test.
2025-02-17Avoid shift wider than unsigned HOST_WIDE_INT on unsigned integer ↵Thomas Koenig1-9/+8
exponentiation. this patch is a variation of Jakub's patch in the PR, which avoids overflow on the mask used for exponentiation and fixes unsigned HOST_WIDE_INT. I tried testing this on a POWER machine, but --with-build-config=bootstrap-ubsan fails bootstrap there. gcc/fortran/ChangeLog: PR fortran/118862 * trans-expr.cc (gfc_conv_cst_int_power): Use functions for unsigned wide integer. (gfc_conv_cst_uint_power): Avoid generating the mask if it would overflow an unsigned HOST_WIDE_INT. Format fixes.
2025-02-17Daily bump.GCC Administrator1-0/+5
2025-02-16Remove double output of attr->save.Thomas Koenig1-4/+0
In the recent patch for dumping all attributes, there were duplicates for attr->save, which is output via gfc_code2string previously. This patch removes that double output. gcc/fortran/ChangeLog: * dump-parse-tree.cc (show_attr): Remove double output of attr->save.
2025-02-16Daily bump.GCC Administrator1-0/+33
2025-02-15Fortran: passing of derived type to VALUE,OPTIONAL dummy argument [PR118080]Harald Anlauf4-23/+30
For scalar OPTIONAL dummy arguments with the VALUE attribute, gfortran passes a hidden flag to denote presence or absence of the actual argument for intrinsic types. Extend this treatment to derived type (user-defined as well as from intrinsic module ISO_C_BINDING). PR fortran/118080 gcc/fortran/ChangeLog: * gfortran.texi: Adjust documentation. * trans-decl.cc (create_function_arglist): Adjust to pass hidden presence flag also for derived type dummies with VALUE,OPTIONAL attribute. * trans-expr.cc (gfc_conv_expr_present): Expect hidden presence flag also for derived type dummies with VALUE,OPTIONAL attribute. (conv_cond_temp): Adjust to allow derived types. (conv_dummy_value): Extend to handle derived type dummies with VALUE,OPTIONAL attribute. (gfc_conv_procedure_call): Adjust for actual arguments passed to derived type dummies with VALUE,OPTIONAL attribute. * trans-types.cc (gfc_get_function_type): Adjust fndecl for hidden presence flag. gcc/testsuite/ChangeLog: * gfortran.dg/value_optional_2.f90: New test.
2025-02-15Fortran: gfortran allows type(C_ptr) in I/O listJerry DeLisle1-2/+2
Before this patch, gfortran was accepting invalid use of type(c_ptr) in I/O statements. The fix affects several existing test cases so no new test case needed. Existing tests were modified to pass by either using the transfer function to convert to an acceptable value or using an assignment to a like type (non-I/O). PR fortran/117430 gcc/fortran/ChangeLog: * resolve.cc (resolve_transfer): Change gfc_notify_std to gfc_error. gcc/testsuite/ChangeLog: * gfortran.dg/c_loc_test_17.f90: Use an assignment rather than PRINT. * gfortran.dg/c_ptr_tests_10.f03: Use a transfer function. * gfortran.dg/c_ptr_tests_16.f90: Use an assignment. * gfortran.dg/c_ptr_tests_9.f03: Use a transfer function. * gfortran.dg/init_flag_17.f90: Likewise. * gfortran.dg/pr32601_1.f03: Use an assignment.
2025-02-15Remove defunct web site for site of Fortran preprocessor.Andrew Pinski1-2/+1
gcc/fortran/ChangeLog: PR fortran/118159 * invoke.texi: Remove mention of defunct web site for Coco.
2025-02-15Fix PR 118884, Lapack build failure.Thomas Koenig1-0/+1
The fix for PR 118845 introduced new checks, which in turn exposed a case where the typespec information on a symbol generated symbol was not set. This led to an apparent type of BT_UNKNOWN, and hence an error. Fixed as obvoius and simple. gcc/fortran/ChangeLog: * frontend-passes.cc (check_externals_procedure): Copy typespec from old to new symbol. gcc/testsuite/ChangeLog: * gfortran.dg/interface_54.f90: New test.
2025-02-14Daily bump.GCC Administrator1-0/+10