aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
AgeCommit message (Collapse)AuthorFilesLines
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.
2023-04-26Daily bump.GCC Administrator1-0/+6
2023-04-25'omp scan' struct block seq update for OpenMP 5.xTobias Burnus2-23/+43
While OpenMP 5.0 required a single structured block before and after the 'omp scan' directive, OpenMP 5.1 changed this to a 'structured block sequence, denoting 2 or more executable statements in OpenMP 5.1 (whoops!) and zero or more in OpenMP 5.2. This commit updates C/C++ to accept zero statements (but till requires the '{' ... '}' for the final-loop-body) and updates Fortran to accept zero or more than one statements. If there is no preceeding or succeeding executable statement, a warning is shown. gcc/c/ChangeLog: * c-parser.cc (c_parser_omp_scan_loop_body): Handle zero exec statements before/after 'omp scan'. gcc/cp/ChangeLog: * parser.cc (cp_parser_omp_scan_loop_body): Handle zero exec statements before/after 'omp scan'. gcc/fortran/ChangeLog: * openmp.cc (gfc_resolve_omp_do_blocks): Handle zero or more than one exec statements before/after 'omp scan'. * trans-openmp.cc (gfc_trans_omp_do): Likewise. libgomp/ChangeLog: * testsuite/libgomp.c-c++-common/scan-1.c: New test. * testsuite/libgomp.c/scan-23.c: New test. * testsuite/libgomp.fortran/scan-2.f90: New test. gcc/testsuite/ChangeLog: * g++.dg/gomp/attrs-7.C: Update dg-error/dg-warning. * gfortran.dg/gomp/loop-2.f90: Likewise. * gfortran.dg/gomp/reduction5.f90: Likewise. * gfortran.dg/gomp/reduction6.f90: Likewise. * gfortran.dg/gomp/scan-1.f90: Likewise. * gfortran.dg/gomp/taskloop-2.f90: Likewise. * c-c++-common/gomp/scan-6.c: New test. * gfortran.dg/gomp/scan-8.f90: New test.
2023-04-23Daily bump.GCC Administrator1-0/+7
2023-04-22Fortran: function results never have the ALLOCATABLE attribute [PR109500]Harald Anlauf1-0/+12
Fortran 2018 8.5.3 (ALLOCATABLE attribute) explains in Note 1 that the result of referencing a function whose result variable has the ALLOCATABLE attribute is a value that does not itself have the ALLOCATABLE attribute. gcc/fortran/ChangeLog: PR fortran/109500 * interface.cc (gfc_compare_actual_formal): Reject allocatable functions being used as actual argument for allocable dummy. gcc/testsuite/ChangeLog: PR fortran/109500 * gfortran.dg/allocatable_function_11.f90: New test. Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
2023-04-15Daily bump.GCC Administrator1-0/+16
2023-04-14Fortran: fix compile-time simplification of SET_EXPONENT [PR109511]Harald Anlauf1-6/+6
gcc/fortran/ChangeLog: PR fortran/109511 * simplify.cc (gfc_simplify_set_exponent): Fix implementation of compile-time simplification of intrinsic SET_EXPONENT for argument X < 1 and for I < 0. gcc/testsuite/ChangeLog: PR fortran/109511 * gfortran.dg/set_exponent_1.f90: New test.
2023-04-14Fortran: Fix an excess finalization during allocation [PR104272]Paul Thomas3-2/+10
2023-04-14 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/104272 * gfortran.h : Add expr3_not_explicit bit field to gfc_code. * resolve.cc (resolve_allocate_expr): Set bit field when the default initializer is applied to expr3. * trans-stmt.cc (gfc_trans_allocate): If expr3_not_explicit is set, do not deallocate expr3. gcc/testsuite/ PR fortran/104272 * gfortran.dg/class_result_8.f90 : Number of builtin_frees down from 6 to 5 without memory leaks. * gfortran.dg/finalize_52.f90: New test
2023-04-14Daily bump.GCC Administrator1-0/+6
2023-04-13Fortran: call of overloaded ‘abs(long long int&)’ is ambiguous [PR109492]Harald Anlauf1-2/+3
gcc/fortran/ChangeLog: PR fortran/109492 * trans-expr.cc (gfc_conv_power_op): Use absu_hwi and unsigned HOST_WIDE_INT for portability.
2023-04-13Daily bump.GCC Administrator1-0/+18
2023-04-12Fortran: fix functions with entry and pointer/allocatable result [PR104312]Harald Anlauf3-1/+24
gcc/fortran/ChangeLog: PR fortran/104312 * resolve.cc (resolve_entries): Handle functions with ENTRY and ALLOCATABLE results. * trans-expr.cc (gfc_conv_procedure_call): Functions with a result with the POINTER or ALLOCATABLE attribute shall not get any special treatment with -ff2c, as they cannot be written in Fortran 77. * trans-types.cc (gfc_return_by_reference): Likewise. (gfc_get_function_type): Likewise. gcc/testsuite/ChangeLog: PR fortran/104312 * gfortran.dg/entry_26.f90: New test. * gfortran.dg/entry_27.f90: New test.
2023-04-12Fortran: resolve correct generic with TYPE(C_PTR) arguments [PR61615,PR99982]Harald Anlauf1-1/+17
gcc/fortran/ChangeLog: PR fortran/61615 PR fortran/99982 * interface.cc (compare_parameter): Enable type and rank checks for arguments of derived type from the intrinsic module ISO_C_BINDING. gcc/testsuite/ChangeLog: PR fortran/61615 PR fortran/99982 * gfortran.dg/interface_49.f90: New test.
2023-04-09Daily bump.GCC Administrator1-0/+32
2023-04-08Fortran: Fix some of the bugs in associate [PR87477]Paul Thomas6-36/+113
2023-04-08 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/87477 * iresolve.cc (gfc_resolve_adjustl, gfc_resolve_adjustr): if string length is deferred use the string typespec for result. * resolve.cc (resolve_assoc_var): Handle parentheses around the target expression. (resolve_block_construct): Remove unnecessary static decls. * trans-array.cc (gfc_conv_expr_descriptor): Guard string len expression in condition. Improve handling of string length and span, especially for substrings of the descriptor. (duplicate_allocatable): Make element type more explicit with 'eltype'. * trans-decl.cc (gfc_get_symbol_decl): Emit a fatal error with appropriate message instead of ICE if symbol type is unknown. (gfc_generate_function_code): Set current locus to proc_sym declared_at. * trans-expr.cc (gfc_get_expr_charlen): Retain last charlen in 'previous' and use if end expression in substring reference is null. (gfc_conv_string_length): Use gfc_conv_expr_descriptor if 'expr_flat' is an array. Add post block to catch deallocation of temporaries. (gfc_conv_procedure_call): Assign the parmse string length to the expression string length, if it is deferred. (gfc_trans_alloc_subarray_assign): If this is a deferred string length component, store the string length in the hidden comp. Update the typespec length accordingly. Generate a new type spec for the call to gfc_duplicate-allocatable in this case. * trans-io.cc (gfc_trans_transfer): Scalarize transfer of deferred character array components. gcc/testsuite/ PR fortran/87477 * gfortran.dg/associate_47.f90 : Enable substring test. * gfortran.dg/associate_51.f90 : Update an error message. * gfortran.dg/goacc/array-with-dt-2.f90 : Add span to uninitialzed dg-warnings. PR fortran/85686 PR fortran/88247 PR fortran/91941 PR fortran/92779 PR fortran/93339 PR fortran/93813 PR fortran/100948 PR fortran/102106 * gfortran.dg/associate_60.f90 : New test PR fortran/98408 * gfortran.dg/pr98408.f90 : New test PR fortran/105205 * gfortran.dg/pr105205.f90 : New test PR fortran/106918 * gfortran.dg/pr106918.f90 : New test
2023-04-05Daily bump.GCC Administrator1-0/+6
2023-04-04Fortran: reject module variable as character length in PARAMETER [PR104349]Harald Anlauf1-2/+0
gcc/fortran/ChangeLog: PR fortran/104349 * expr.cc (check_restricted): Adjust check for valid variables in restricted expressions: make no exception for module variables. gcc/testsuite/ChangeLog: PR fortran/104349 * gfortran.dg/der_charlen_1.f90: Adjust dg-patterns. * gfortran.dg/pr104349.f90: New test.
2023-04-02Daily bump.GCC Administrator1-0/+5
2023-04-01Change "long_double" into "long double" for C prototypes from Fortran.Thomas Koenig1-0/+2
gcc/fortran/ChangeLog: * dump-parse-tree.cc (get_c_type_name): Fix "long_long" type name to be "long long".
2023-03-31Daily bump.GCC Administrator1-0/+6
2023-03-29Fix fc-prototypes usage with C_INT64_T and non LP64 Targets.Andrew Pinski1-0/+3
The problem here is we were outputing long_long instead of "long long". This was just an oversight and a missing check. Committed as obvious after a bootstrap/test on x86_64-linux-gnu. gcc/fortran/ChangeLog: * dump-parse-tree.cc (get_c_type_name): Fix "long_long" type name to be "long long". Add a comment on why adding 2 to the name too.
2023-03-29Daily bump.GCC Administrator1-0/+6
2023-03-28openmp: Fix typo in diagnostics [PR109314]Jakub Jelinek1-1/+1
Trivial typo fix. 2023-03-28 Jakub Jelinek <jakub@redhat.com> PR fortran/109314 * openmp.cc (gfc_omp_absent_contains_clause): Fix typo in diagnostics - composit -> composite.
2023-03-26Daily bump.GCC Administrator1-0/+5
2023-03-25Fortran: remove dead code [PR104321]Harald Anlauf1-3/+0
gcc/fortran/ChangeLog: PR fortran/104321 * trans-decl.cc (gfc_conv_cfi_to_gfc): Remove dead code.
2023-03-25Daily bump.GCC Administrator1-0/+19
2023-03-24Fortran: fix FE memleak with BOZ expressions.Harald Anlauf1-0/+4
gcc/fortran/ChangeLog: * expr.cc (free_expr0): Free also BOZ strings as part of an expression.
2023-03-24Fortran: Escalate failure when Hollerith constant to real conversion failsHaochen Gui5-9/+29
gcc/fortran/ PR target/103628 * target-memory.cc (gfc_interpret_float): Return FAIL when native_interpret_expr gets a NULL tree. * arith.cc (gfc_hollerith2real): Return NULL when gfc_interpret_float fails. * error.cc (gfc_buffered_p): Define. * gfortran.h (gfc_buffered_p): Declare. * intrinsic.cc: Add diagnostic.h to include list. (do_simplify): Save errorcount and check it at finish. Report a "Cannot simplify expression" error on a bad result if error count doesn't change and no other errors buffered. gcc/testsuite/ PR target/103628 * gfortran.dg/assumed_size_refs_2.f90: Check "Cannot simplify expression" error. * gfortran.dg/unpack_field_1.f90: Likewise. * gfortran.dg/pr103628.f90: New. Co-Authored-By: Tobias Burnus <tobias@codesourcery.com>
2023-03-23Daily bump.GCC Administrator1-0/+7
2023-03-22Fortran: improve checking of FINAL subroutine arguments [PR104572]Harald Anlauf1-0/+7
gcc/fortran/ChangeLog: PR fortran/104572 * resolve.cc (gfc_resolve_finalizers): Argument of a FINAL subroutine cannot be an alternate return. gcc/testsuite/ChangeLog: PR fortran/104572 * gfortran.dg/pr104572.f90: New test. Co-authored-by: Steven G. Kargl <kargl@gcc.gnu.org>
2023-03-22Daily bump.GCC Administrator1-0/+23
2023-03-21Fortran: reject MODULE PROCEDURE outside generic module interface [PR99036]Harald Anlauf1-3/+4
gcc/fortran/ChangeLog: PR fortran/99036 * decl.cc (gfc_match_modproc): Reject MODULE PROCEDURE if not in a generic module interface. gcc/testsuite/ChangeLog: PR fortran/99036 * gfortran.dg/pr99036.f90: New test.
2023-03-21doc: Remove the @gol macro/aliasArsen Arsenović2-401/+401
The @gol macro appears to have existed as a workaround for a bug in old versions of makeinfo and/or texinfo.tex, where they would, in some types of output, fail to emit line breaks in @gccoptlists. After updating texinfo.tex, I noticed that this behavior appears to no longer be exhibited, instead, both acted correctly and inserted newlines. The (groff) manual output also appears unaffected. gcc/ChangeLog: * doc/implement-c.texi: Remove usage of @gol. * doc/invoke.texi: Ditto. * doc/sourcebuild.texi: Ditto. * doc/include/gcc-common.texi: Remove @gol. In new Makeinfo and texinfo.tex versions, the bug it was working around appears to be gone. gcc/fortran/ChangeLog: * invoke.texi: Remove usages of @gol. * intrinsic.texi: Ditto.
2023-03-21Fortran: Fix regression caused by PR37336 patch [PR109206]Paul Thomas1-1/+4
2023-03-21 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/109206 * trans-array.cc (gfc_trans_array_constructor_value): Correct incorrect setting of typespec.
2023-03-21Fortran: Fix regression caused by PR37336 patch [PR109209]Paul Thomas1-0/+1
2023-03-21 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/109209 * resolve.cc (generate_component_assignments): Restore the exclusion of allocatable components from the loop. gcc/testsuite/ PR fortran/109209 * gfortran.dg/pr109209.f90: New test.