aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
AgeCommit message (Collapse)AuthorFilesLines
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
2025-02-13Fix LAPACK build error due to global symbol checking.Thomas Koenig1-4/+27
This was an interesting regression. It came from my recent patch, where an assert was triggered because a procedure artificial dummy argument generated for a global symbol did not have the information if if was a function or a subroutine. Fixed by adding the information in gfc_get_formal_from_actual_arglist. This information then uncovered some new errors, also in the testsuite, which needed fixing. Finally, the error is made to look a bit nicer, so the user gets a pointer to where the original interface comes from. gcc/fortran/ChangeLog: PR fortran/118845 * interface.cc (compare_parameter): If the formal attribute has been generated from an actual argument list, also output an pointer to there in case of an error. (gfc_get_formal_from_actual_arglist): Set function and subroutine attributes and (if it is a function) the typespec from the actual argument. gcc/testsuite/ChangeLog: PR fortran/118845 * gfortran.dg/recursive_check_4.f03: Adjust call so types matche. * gfortran.dg/recursive_check_6.f03: Likewise. * gfortran.dg/specifics_2.f90: Adjust calls so types match. * gfortran.dg/interface_52.f90: New test. * gfortran.dg/interface_53.f90: New test.
2025-02-12Daily bump.GCC Administrator1-0/+6
2025-02-11OpenMP: Pass a 3-way flag to omp_check_context_selector instead of a bool.Sandra Loosemore1-2/+3
The OpenMP "begin declare variant" directive has slightly different requirements for context selectors than regular "declare variant", so something more than a bool is required to tell the error-checking routine what to check. gcc/ChangeLog * omp-general.cc (omp_check_context_selector): Change metadirective_p argument to a 3-way flag. Add extra check for OMP_CTX_BEGIN_DECLARE_VARIANT. * omp-general.h (enum omp_ctx_directive): New. (omp_check_context_selector): Adjust declaration. gcc/c/ChangeLog * c-parser.cc (c_finish_omp_declare_variant): Update call to omp_check_context_selector. (c_parser_omp_metadirective): Likewise. gcc/cp/ChangeLog * parser.cc (cp_finish_omp_declare_variant): Update call to omp_check_context_selector. (cp_parser_omp_metadirective): Likewise. gcc/fortran/ChangeLog * trans-openmp.cc (gfc_trans_omp_declare_variant): Update call to omp_check_context_selector. (gfc_trans_omp_metadirective): Likewise.
2025-02-11Daily bump.GCC Administrator1-0/+12
2025-02-10This improves an error message, avoiding at ... at.Thomas Koenig1-3/+3
gcc/fortran/ChangeLog: PR fortran/24878 * interface.cc (compare_parameter): Better wording on error message. gcc/testsuite/ChangeLog: PR fortran/24878 * gfortran.dg/interface_51.f90: Adjust expected error message.
2025-02-10Fortran: checking of pointer targets for structure constructors [PR56423]Harald Anlauf1-1/+11
Check the target of a pointer component in a structure constructor for same ranks, and that the initial-data-target does not have vector subscripts. PR fortran/56423 gcc/fortran/ChangeLog: * resolve.cc (resolve_structure_cons): Check rank of pointer target; reject pointer target with vector subscripts. gcc/testsuite/ChangeLog: * gfortran.dg/derived_constructor_comps_2.f90: Adjust test. * gfortran.dg/derived_constructor_comps_8.f90: New test.
2025-02-10Daily bump.GCC Administrator1-0/+7
2025-02-09Test procedure dummy arguments against global symbols, if available.Thomas Koenig1-1/+46
this fixes a rather old PR from 2005, where a subroutine could be passed and called as a function. This patch checks for that, also for the reverse, and for wrong types of functions. I expect that this will find a few bugs in dusty deck code... gcc/fortran/ChangeLog: PR fortran/24878 * interface.cc (compare_parameter): Check global subroutines passed as actual arguments for subroutine / function and function type. gcc/testsuite/ChangeLog: PR fortran/24878 * gfortran.dg/interface_51.f90: New test.
2025-02-09Daily bump.GCC Administrator1-0/+10
2025-02-08[PATCH] OpenMP: Improve Fortran metadirective diagnostics [PR107067]Sandra Loosemore1-9/+53
The Fortran front end was giving an ICE instead of a user-friendly diagnostic when variants of a metadirective variant had different statement associations. The particular test case reported in the issue also involved invalid placement of the "omp end metadirective" which was not being diagnosed either. gcc/fortran/ChangeLog PR middle-end/107067 * parse.cc (parse_omp_do): Diagnose missing "OMP END METADIRECTIVE" after loop. (parse_omp_structured_block): Likewise for strictly structured block. (parse_omp_metadirective_body): Use better test for variants ending at different places. Issue a user diagnostic at the end if any were inconsistent, instead of calling gcc_assert. gcc/testsuite/ChangeLog PR middle-end/107067 * gfortran.dg/gomp/metadirective-11.f90: Remove the dg-ice, update for current behavior, and add more tests to exercise the new error code.
2025-02-08Daily bump.GCC Administrator1-0/+13
2025-02-07Fortran: fix initialization of allocatable non-deferred character [PR59252]Harald Anlauf1-2/+6
PR fortran/59252 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_trans_subcomponent_assign): Initialize allocatable non-deferred character with NULL properly. gcc/testsuite/ChangeLog: * gfortran.dg/allocatable_char_1.f90: New test.
2025-02-07Fortran: Fix default init of finalizable derived argus [PR116829]Paul Thomas1-15/+6
2025-02-07 Tomáš Trnka <trnka@scm.com> gcc/fortran PR fortran/116829 * trans-decl.cc (init_intent_out_dt): Always call gfc_init_default_dt() for BT_DERIVED to apply s->value if the symbol isn't allocatable. Also simplify the logic a bit. gcc/testsuite/ PR fortran/116829 * gfortran.dg/derived_init_7.f90: New test.
2025-02-07Daily bump.GCC Administrator1-0/+8
2025-02-06Fortran: FIx ICE in associate with elemental function [PR118750]Paul Thomas1-1/+1
2025-02-06 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/118750 * resolve.cc (resolve_assoc_var): If the target expression has a rank, do not use gfc_expression_rank, since it will return 0 if the function is elemental. Resolution will have produced the correct rank. gcc/testsuite/ PR fortran/118750 * gfortran.dg/associate_72.f90: New test.
2025-02-06Daily bump.GCC Administrator1-0/+19
2025-02-05Fortran/OpenMP: Add location data to 'sorry' [PR118740]Tobias Burnus2-5/+9
PR fortran/118740 gcc/fortran/ChangeLog: * openmp.cc (gfc_match_omp_context_selector, match_omp_metadirective): Change sorry to sorry_at and use gfc_current_locus as location. * trans-openmp.cc (gfc_trans_omp_clauses): Likewise, but use n->where. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/append_args-2.f90: Update for line change.
2025-02-05fortran/trans-openmp.cc: Use the correct member in gfc_omp_namelist [PR118745]Tobias Burnus1-1/+1
gcc/fortran/ChangeLog: PR fortran/118745 * trans-openmp.cc (gfc_trans_omp_declare_variant): Use append_args_list in the condition for the append_arg location.
2025-02-04Fortran: Fix PR 47485.Jerry DeLisle1-6/+12
The -MT and -MQ options should replace the default target in the generated dependency file. deps_add_target needs to be called before cpp_read_main_file, otherwise the original object name is added. Contributed by Vincent Vanlaer <vincenttc@volkihar.be> PR fortran/47485 gcc/fortran/ChangeLog: * cpp.cc: fix -MT/-MQ adding additional target instead of replacing the default. gcc/testsuite/ChangeLog: * gfortran.dg/dependency_generation_1.f90: New test. Signed-off-by: Vincent Vanlaer <vincenttc@volkihar.be>
2025-02-05Daily bump.GCC Administrator1-0/+16
2025-02-04Add modular exponentiation for UNSIGNED.Thomas Koenig7-25/+215
gcc/fortran/ChangeLog: * arith.cc (arith_power): Handle modular arithmetic for BT_UNSIGNED. (eval_intrinsic): Error for unsigned exponentiation with -pedantic. * expr.cc (gfc_type_convert_binary): Use type of first argument for unsigned exponentiation. * gfortran.texi: Mention arithmetic exponentiation. * resolve.cc (resolve_operator): Allow unsigned exponentiation. * trans-decl.cc (gfc_build_intrinsic_function_decls): Build declarations for unsigned exponentiation. * trans-expr.cc (gfc_conv_cst_uint_power): New function. (gfc_conv_power_op): Call it. Handle unsigned exponentiation. * trans.h (gfor_fndecl_unsigned_pow_list): Add declaration. libgfortran/ChangeLog: * Makefile.am: Add files for unsigned exponentiation. * Makefile.in: Regenerate. * gfortran.map: Add functions for unsigned exponentiation. * generated/pow_m16_m1.c: New file. * generated/pow_m16_m16.c: New file. * generated/pow_m16_m2.c: New file. * generated/pow_m16_m4.c: New file. * generated/pow_m16_m8.c: New file. * generated/pow_m1_m1.c: New file. * generated/pow_m1_m16.c: New file. * generated/pow_m1_m2.c: New file. * generated/pow_m1_m4.c: New file. * generated/pow_m1_m8.c: New file. * generated/pow_m2_m1.c: New file. * generated/pow_m2_m16.c: New file. * generated/pow_m2_m2.c: New file. * generated/pow_m2_m4.c: New file. * generated/pow_m2_m8.c: New file. * generated/pow_m4_m1.c: New file. * generated/pow_m4_m16.c: New file. * generated/pow_m4_m2.c: New file. * generated/pow_m4_m4.c: New file. * generated/pow_m4_m8.c: New file. * generated/pow_m8_m1.c: New file. * generated/pow_m8_m16.c: New file. * generated/pow_m8_m2.c: New file. * generated/pow_m8_m4.c: New file. * generated/pow_m8_m8.c: New file. * m4/powu.m4: New file. gcc/testsuite/ChangeLog: * gfortran.dg/unsigned_15.f90: Adjust error messages. * gfortran.dg/unsigned_43.f90: New test. * gfortran.dg/unsigned_44.f90: New test.
2025-02-04Daily bump.GCC Administrator1-0/+6
2025-02-03Fortran: different character lengths in array constructor [PR93289]Harald Anlauf1-6/+14
PR fortran/93289 gcc/fortran/ChangeLog: * decl.cc (gfc_set_constant_character_len): Downgrade different string lengths in character array constructor to legacy extension. gcc/testsuite/ChangeLog: * gfortran.dg/unlimited_polymorphic_1.f03: Pad element in character array constructor to correct length. * gfortran.dg/char_array_constructor_5.f90: New test.
2025-02-01Daily bump.GCC Administrator1-0/+12
2025-01-31Fortran: host association issue with symbol in COMMON block [PR108454]Harald Anlauf1-1/+8
When resolving a flavorless symbol that is already registered with a COMMON block, and which neither has the intrinsic, generic, or external attribute, skip searching among interfaces to avoid false resolution to a derived type of the same name. PR fortran/108454 gcc/fortran/ChangeLog: * resolve.cc (resolve_common_blocks): Initialize variable. (resolve_symbol): If a symbol is already registered with a COMMON block, do not search for an interface with the same name. gcc/testsuite/ChangeLog: * gfortran.dg/common_29.f90: New test.
2025-01-31OpenMP/Fortran: Add missing pop_state in parse_omp_dispatch [PR118714]Paul-Antoine Arras1-1/+4
When the ST_NONE case is taken, the function returns immediately. Not calling pop_state causes a dangling pointer. PR fortran/118714 gcc/fortran/ChangeLog: * parse.cc (parse_omp_dispatch): Add missing pop_state.
2025-01-31Daily bump.GCC Administrator1-0/+99
2025-01-30OpenMP: Fortran support for metadirectives and dynamic selectorsSandra Loosemore15-362/+929
gcc/fortran/ChangeLog PR middle-end/112779 PR middle-end/113904 * decl.cc (gfc_match_end): Handle COMP_OMP_BEGIN_METADIRECTIVE and COMP_OMP_METADIRECTIVE. * dump-parse-tree.cc (show_omp_node): Handle EXEC_OMP_METADIRECTIVE. (show_code_node): Likewise. * gfortran.h (enum gfc_statement): Add ST_OMP_METADIRECTIVE, ST_OMP_BEGIN_METADIRECTIVE, and ST_OMP_END_METADIRECTIVE. (struct gfc_omp_clauses): Rename target_first_st_is_teams to target_first_st_is_teams_or_meta. (struct gfc_omp_variant): New. (gfc_get_omp_variant): New. (struct gfc_st_label): Add omp_region field. (enum gfc_exec_op): Add EXEC_OMP_METADIRECTIVE. (struct gfc_code): Add omp_variants fields. (gfc_free_omp_variants): Declare. (match_omp_directive): Declare. (is_omp_declarative_stmt): Declare. * io.cc (format_asterisk): Adjust initializer. * match.h (gfc_match_omp_begin_metadirective): Declare. (gfc_match_omp_metadirective): Declare. * openmp.cc (gfc_omp_directives): Uncomment metadirective. (gfc_match_omp_eos): Adjust to match context selectors. (gfc_free_omp_variants): New. (gfc_match_omp_clauses): Remove context_selector parameter and adjust to use gfc_match_omp_eos instead. (match_omp): Adjust call to gfc_match_omp_clauses. (gfc_match_omp_context_selector): Add metadirective_p parameter and adjust error-checking. Adjust matching of simd clauses. (gfc_match_omp_context_selector_specification): Adjust parameters so it can be used for metadirective as well as declare variant. (match_omp_metadirective): New. (gfc_match_omp_begin_metadirective): New. (gfc_match_omp_metadirective): New. (resolve_omp_metadirective): New. (resolve_omp_target): Handle metadirectives. (gfc_resolve_omp_directive): Handle EXEC_OMP_METADIRECTIVE. * parse.cc (gfc_matching_omp_context_selector): New. (gfc_in_omp_metadirective_body): New. (gfc_omp_region_count): New. (decode_omp_directive): Handle ST_OMP_BEGIN_METADIRECTIVE and ST_OMP_METADIRECTIVE. (match_omp_directive): New. (case_omp_structured_block): Define. (case_omp_do): Define. (gfc_ascii_statement): Handle ST_OMP_BEGIN_METADIRECTIVE, ST_OMP_END_METADIRECTIVE, and ST_OMP_METADIRECTIVE. (accept_statement): Handle ST_OMP_METADIRECTIVE and ST_OMP_BEGIN_METADIRECTIVE. (gfc_omp_end_stmt): New, split from... (parse_omp_do): ...here, and... (parse_omp_structured_block): ...here. Handle metadirectives, plus "allocate", "atomic", and "dispatch" which were missing. (parse_omp_oacc_atomic): Handle "end metadirective". (parse_openmp_allocate_block): Likewise. (parse_omp_dispatch): Likewise. (parse_omp_metadirective_body): New. (parse_executable): Handle metadirective. Use new case macros defined above. (gfc_parse_file): Initialize metadirective state. (is_omp_declarative_stmt): New. * parse.h (enum gfc_compile_state): Add COMP_OMP_METADIRECTIVE and COMP_OMP_BEGIN_METADIRECTIVE. (gfc_omp_end_stmt): Declare. (gfc_matching_omp_context_selector): Declare. (gfc_in_omp_metadirective_body): Declare. (gfc_omp_metadirective_region_count): Declare. * resolve.cc (gfc_resolve_code): Handle EXEC_OMP_METADIRECTIVE. * st.cc (gfc_free_statement): Likewise. * symbol.cc (compare_st_labels): Handle labels within a metadirective body. (gfc_get_st_label): Likewise. * trans-decl.cc (gfc_get_label_decl): Encode the metadirective region in the label_name. * trans-openmp.cc (gfc_trans_omp_directive): Handle EXEC_OMP_METADIRECTIVE. (gfc_trans_omp_set_selector): New, split/adapted from code.... (gfc_trans_omp_declare_variant): ...here. (gfc_trans_omp_metadirective): New. * trans-stmt.h (gfc_trans_omp_metadirective): Declare. * trans.cc (trans_code): Handle EXEC_OMP_METADIRECTIVE. gcc/testsuite/ChangeLog PR middle-end/112779 PR middle-end/113904 * gfortran.dg/gomp/metadirective-1.f90: New. * gfortran.dg/gomp/metadirective-10.f90: New. * gfortran.dg/gomp/metadirective-11.f90: New. * gfortran.dg/gomp/metadirective-12.f90: New. * gfortran.dg/gomp/metadirective-13.f90: New. * gfortran.dg/gomp/metadirective-2.f90: New. * gfortran.dg/gomp/metadirective-3.f90: New. * gfortran.dg/gomp/metadirective-4.f90: New. * gfortran.dg/gomp/metadirective-5.f90: New. * gfortran.dg/gomp/metadirective-6.f90: New. * gfortran.dg/gomp/metadirective-7.f90: New. * gfortran.dg/gomp/metadirective-8.f90: New. * gfortran.dg/gomp/metadirective-9.f90: New. * gfortran.dg/gomp/metadirective-construct.f90: New. * gfortran.dg/gomp/metadirective-no-score.f90: New. * gfortran.dg/gomp/pure-1.f90 (func_metadirective): New. (func_metadirective_2): New. (func_metadirective_3): New. * gfortran.dg/gomp/pure-2.f90 (func_metadirective): Delete. libgomp/ChangeLog PR middle-end/112779 PR middle-end/113904 * testsuite/libgomp.fortran/metadirective-1.f90: New. * testsuite/libgomp.fortran/metadirective-2.f90: New. * testsuite/libgomp.fortran/metadirective-3.f90: New. * testsuite/libgomp.fortran/metadirective-4.f90: New. * testsuite/libgomp.fortran/metadirective-5.f90: New. * testsuite/libgomp.fortran/metadirective-6.f90: New. Co-Authored-By: Kwok Cheung Yeung <kcy@codesourcery.com> Co-Authored-By: Sandra Loosemore <sandra@codesourcery.com> Co-Authored-By: Tobias Burnus <tobias@codesourcery.com> Co-Authored-By: Paul-Antoine Arras <pa@codesourcery.com>
2025-01-30OpenMP: append_args clause fixes + Fortran supportTobias Burnus3-42/+300
This fixes a large number of smaller and larger issues with the append_args clause to 'declare variant' and adds Fortran support for it; it also contains a larger number of testcases. In particular, for Fortran, it also handles passing allocatable, pointer, optional arguments to an interop dummy argument with or without value attribute. And it changes the internal representation such that dumping the tree does not lead to an ICE. gcc/c/ChangeLog: * c-parser.cc (c_finish_omp_declare_variant): Modify how append_args is saved internally. gcc/cp/ChangeLog: * parser.cc (cp_finish_omp_declare_variant): Modify how append_args is saved internally. * pt.cc (tsubst_attribute): Likewise. (tsubst_omp_clauses): Remove C_ORT_OMP_DECLARE_SIMD from interop handling as no longer called for it. * decl.cc (omp_declare_variant_finalize_one): Update append_args changes; fixes for ADL input. gcc/fortran/ChangeLog: * gfortran.h (gfc_omp_declare_variant): Add append_args_list. * openmp.cc (gfc_parser_omp_clause_init_modifiers): New; splitt of from ... (gfc_match_omp_init): ... here; call it. (gfc_match_omp_declare_variant): Update to handle append_args clause; some syntax handling fixes. * trans-openmp.cc (gfc_trans_omp_declare_variant): Handle append_args clause; add some diagnostic. gcc/ChangeLog: * gimplify.cc (gimplify_call_expr): For OpenMP's append_args clause processed by 'omp dispatch', update for internal-representation changes; fix handling of hidden arguments, add some comments and handle Fortran's value dummy and optional/pointer/allocatable actual args. libgomp/ChangeLog: * libgomp.texi (Impl. Status): Update for accumpulated changes related to 'dispatch' and interop. gcc/testsuite/ChangeLog: * c-c++-common/gomp/append-args-1.c: Update dg-*. * c-c++-common/gomp/append-args-3.c: Likewise. * g++.dg/gomp/append-args-1.C: Likewise. * gfortran.dg/gomp/adjust-args-1.f90: Likewise. * gfortran.dg/gomp/adjust-args-3.f90: Likewise. * gfortran.dg/gomp/declare-variant-2.f90: Likewise. * c-c++-common/gomp/append-args-6.c: New test. * c-c++-common/gomp/append-args-7.c: New test. * c-c++-common/gomp/append-args-8.c: New test. * c-c++-common/gomp/append-args-9.c: New test. * g++.dg/gomp/append-args-4.C: New test. * g++.dg/gomp/append-args-5.C: New test. * g++.dg/gomp/append-args-6.C: New test. * g++.dg/gomp/append-args-7.C: New test. * gcc.dg/gomp/append-args-1.c: New test. * gfortran.dg/gomp/append_args-1.f90: New test. * gfortran.dg/gomp/append_args-2.f90: New test. * gfortran.dg/gomp/append_args-3.f90: New test. * gfortran.dg/gomp/append_args-4.f90: New test.
2025-01-30Daily bump.GCC Administrator1-0/+7
2025-01-29Fortran: fix passing of component ref to assumed-rank dummy [PR118683]Harald Anlauf1-0/+3
While the fix for pr117774 addressed the passing of an inquiry reference to an assumed-rank dummy, it missed the similar case of passing a component reference. The newer testcase gfortran.dg/pr81978.f90 uncovered this latent issue with a UBSAN instrumented compiler. PR fortran/118683 gcc/fortran/ChangeLog: * trans-expr.cc (gfc_conv_procedure_call): The bounds update for passing to assumed-rank dummies shall also handle component references besides inquiry references.
2025-01-28Daily bump.GCC Administrator1-0/+15
2025-01-27Fortran: fix bogus diagnostics on renamed interface import [PR110993]Harald Anlauf1-0/+7
PR fortran/110993 gcc/fortran/ChangeLog: * frontend-passes.cc (check_externals_procedure): Do not compare interfaces of a non-bind(C) procedure against a bind(C) global one. (check_against_globals): Use local name from rename-on-use in the search for interfaces. gcc/testsuite/ChangeLog: * gfortran.dg/use_rename_14.f90: New test.
2025-01-27Fortran: ICE in gfc_conv_expr_present w. defined assignment [PR118640]Paul Thomas1-0/+5
2025-01-27 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/118640 * resolve.cc (generate_component_assignments): Make sure that the rhs temporary does not pick up the optional attribute from the lhs. gcc/testsuite/ PR fortran/118640 * gfortran.dg/pr118640.f90: New test.
2025-01-27Daily bump.GCC Administrator1-0/+9
2025-01-27Fortran: In openmp.cc, uncomment unroll/tile lines of gfc_omp_directivesTobias Burnus1-2/+2
Enable unroll and tile for assume's contains/absent clauses as both directives are implemented since r15-1037-g804c0f35a6b1d7. gcc/fortran/ChangeLog: * openmp.cc (gfc_omp_directives): Uncomment unroll and tile lines as the directives are by now implemented.
2025-01-26OpenMP: Fix typo in atomic directive error messageSandra Loosemore1-1/+1
gcc/fortran/ChangeLog * openmp.cc (resolve_omp_atomic): Fix typo in error message. gcc/testsuite/ChangeLog * gfortran.dg/gomp/atomic-26.f90: Correct expected output after fixing typo in error message.
2025-01-26Daily bump.GCC Administrator1-0/+10
2025-01-25Fortran: fix issues with variables in BLOCK DATA [PR58857]Harald Anlauf2-0/+27
PR fortran/58857 gcc/fortran/ChangeLog: * class.cc (gfc_find_derived_vtab): Declare some frontend generated variables and procedures (_vtab, _copy, _deallocate) as artificial. (find_intrinsic_vtab): Likewise. * trans-decl.cc (check_block_data_decls): New helper function. (gfc_generate_block_data): Use it to emit warnings for variables declared in a BLOCK DATA program unit but not in a COMMON block. gcc/testsuite/ChangeLog: * gfortran.dg/uncommon_block_data_2.f90: New test.
2025-01-24Daily bump.GCC Administrator1-0/+19
2025-01-23Fortran: do not evaluate arguments of MAXVAL/MINVAL too often [PR118613]Harald Anlauf1-4/+33
PR fortran/118613 gcc/fortran/ChangeLog: * trans-intrinsic.cc (gfc_conv_intrinsic_minmaxval): Adjust algorithm for inlined version of MINLOC and MAXLOC so that arguments are only evaluted once, and create temporaries where necessary. Document change of algorithm. gcc/testsuite/ChangeLog: * gfortran.dg/maxval_arg_eval_count.f90: New test.
2025-01-23Fortran: Regression- fix ICE at fortran/trans-decl.c:1575 [PR96087]Paul Thomas2-1/+16
2025-01-23 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/96087 * trans-decl.cc (gfc_get_symbol_decl): If a dummy is missing a backend decl, it is likely that it has come from a module proc interface. Look for the formal symbol by name in the containing proc and use its backend decl. * trans-expr.cc (gfc_apply_interface_mapping_to_expr): For the same reason, match the name, rather than the symbol address to perform the mapping. gcc/testsuite/ PR fortran/96087 * gfortran.dg/pr96087.f90: New test.
2025-01-21Daily bump.GCC Administrator1-0/+12
2025-01-20Fortran: improve error message for conflicting OpenMP clauses [PR107122]Harald Anlauf1-1/+1
PR fortran/107122 gcc/fortran/ChangeLog: * openmp.cc (resolve_omp_clauses): Add 'with' to error message text. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/order-8.f90: Adjust pattern.
2025-01-20Fortran: do not copy back for parameter actual arguments [PR81978]Harald Anlauf2-4/+17
When an array is packed for passing as an actual argument, and the array has the PARAMETER attribute (i.e., it is a named constant that can reside in read-only memory), do not copy back (unpack) from the temporary. PR fortran/81978 gcc/fortran/ChangeLog: * trans-array.cc (gfc_conv_array_parameter): Do not copy back data if actual array parameter has the PARAMETER attribute. * trans-expr.cc (gfc_conv_subref_array_arg): Likewise. gcc/testsuite/ChangeLog: * gfortran.dg/pr81978.f90: New test.
2025-01-17Daily bump.GCC Administrator1-0/+34
2025-01-16Fortran/OpenMP: Fix declare_variant's 'adjust_args' mishandling with return ↵Tobias Burnus1-3/+11
by reference [PR118321] declare_variant's 'adjust_args' clause references the arguments in the middle end by the argument position; this has to account for hidden arguments that are inserted before due to return by reference, as done in this commit. PR fortran/118321 gcc/fortran/ChangeLog: * trans-openmp.cc (gfc_trans_omp_declare_variant): Honor hidden arguments for append_arg's need_device_ptr. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/adjust-args-12.f90: New test.
2025-01-16Allow CFI_cdesc_t in argument lists with -fc-prototypes.Thomas Koenig3-26/+136
This patch fixes and reorganizes dumping C prototypes. It makes the following changes: - BIND(C) types are now always output before any global symbols - CFI_cdesc_t is issued for assumed shape and assumed rank arguments. - BIND(C,NAME="...") entities were not always issued. gcc/fortran/ChangeLog: PR fortran/118359 * dump-parse-tree.cc (show_external_symbol): New function. (write_type): Add prototype, put in restrictions on what not to dump. (has_cfi_cdesc): New function. (need_iso_fortran_binding): New function. (gfc_dump_c_prototypes): Adjust to take only a file output. Add "#include <ISO_Fortran_binding.h" if CFI_cdesc_t is found. Traverse global namespaces to dump types and the globalsymol list to dump external symbols. (gfc_dump_external_c_prototypes): Traverse global namespaces. (get_c_type_name): Handle CFI_cdesc_t. (write_proc): Also pass array spec to get_c_type_name. * gfortran.h (gfc_dump_c_prototypes): Adjust prototype. * parse.cc (gfc_parse_file): Adjust call to gfc_dump_c_prototypes.