aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
AgeCommit message (Collapse)AuthorFilesLines
2020-10-08Daily bump.GCC Administrator1-0/+6
2020-10-07This patch fixes PR47469 - a trivial bit of tidying up.Paul Thomas1-6/+2
2020-07-10 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/47469 * trans-expr.c (arrayfunc_assign_needs_temporary): Tidy detection of pointer and allocatable functions.
2020-10-05Daily bump.GCC Administrator1-0/+8
2020-10-04PR fortran/97272 - Wrong answer from MAXLOC with character argHarald Anlauf1-0/+19
The optional KIND argument to the MINLOC/MAXLOC intrinsic must not be passed to the library function, as the kind conversion of the result is treated explicitly elsewhere. gcc/fortran/ChangeLog: PR fortran/97272 * trans-intrinsic.c (strip_kind_from_actual): Helper function for removal of KIND argument. (gfc_conv_intrinsic_minmaxloc): Ignore KIND argument here, as it is treated elsewhere. gcc/testsuite/ChangeLog: PR fortran/97272 * gfortran.dg/pr97272.f90: New test.
2020-10-03Daily bump.GCC Administrator1-0/+9
2020-10-02Perforate fnspec stringsJan Hubicka3-126/+160
gcc/ChangeLog: 2020-10-02 Jan Hubicka <hubicka@ucw.cz> * attr-fnspec.h: Update documentation. (attr_fnsec::return_desc_size): Set to 2 (attr_fnsec::arg_desc_size): Set to 2 * builtin-attrs.def (STR1): Update fnspec. * internal-fn.def (UBSAN_NULL): Update fnspec. (UBSAN_VPTR): Update fnspec. (UBSAN_PTR): Update fnspec. (ASAN_CHECK): Update fnspec. (GOACC_DIM_SIZE): Remove fnspec. (GOACC_DIM_POS): Remove fnspec. * tree-ssa-alias.c (attr_fnspec::verify): Update verification. gcc/fortran/ChangeLog: 2020-10-02 Jan Hubicka <hubicka@ucw.cz> * trans-decl.c (gfc_build_library_function_decl_with_spec): Verify fnspec. (gfc_build_intrinsic_function_decls): Update fnspecs. (gfc_build_builtin_function_decls): Update fnspecs. * trans-io.c (gfc_build_io_library_fndecls): Update fnspecs. * trans-types.c (create_fn_spec): Update fnspecs.
2020-10-01Daily bump.GCC Administrator1-0/+37
2020-09-30Fix some fnspec strings in trans-decl.cJan Hubicka1-13/+13
* trans-decl.c (gfc_build_intrinsic_function_decls): Add traling dots to spec strings so they match the number of parameters; do not use R and W for non-pointer parameters. Drop pointless specifier on caf_stop_numeric and caf_get_team.
2020-09-30Add trailing dots so length of spec string matches number of arguments.Jan Hubicka1-23/+23
2020-09-30 Jan Hubicka <hubicka@ucw.cz> * trans-io.c (gfc_build_io_library_fndecls): Add trailing dots so length of spec string matches number of arguments.
2020-09-30Fortran: add contiguous check for ptr assignment, fix non-contig check (PR97242)Tobias Burnus1-7/+19
gcc/fortran/ChangeLog: PR fortran/97242 * expr.c (gfc_is_not_contiguous): Fix check. (gfc_check_pointer_assign): Use it. gcc/testsuite/ChangeLog: PR fortran/97242 * gfortran.dg/contiguous_11.f90: New test. * gfortran.dg/contiguous_4.f90: Update. * gfortran.dg/contiguous_7.f90: Update.
2020-09-30This patch fixes PR97045 - unlimited polymorphic array element selectors.Paul Thomas4-3/+39
2020-30-09 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/97045 * trans-array.c (gfc_conv_array_ref): Make sure that the class decl is passed to build_array_ref in the case of unlimited polymorphic entities. * trans-expr.c (gfc_conv_derived_to_class): Ensure that array refs do not preceed the _len component. Free the _len expr. * trans-stmt.c (trans_associate_var): Reset 'need_len_assign' for polymorphic scalars. * trans.c (gfc_build_array_ref): When the vptr size is used for span, multiply by the _len field of unlimited polymorphic entities, when non-zero. gcc/testsuite/ PR fortran/97045 * gfortran.dg/select_type_50.f90 : New test.
2020-09-30[nvptx] Add type arg to TARGET_LIBC_HAS_FUNCTIONTom de Vries1-2/+2
GCC has a target hook TARGET_LIBC_HAS_FUNCTION, which tells the compiler which functions it can expect to be present in libc. The default target hook does not include the sincos functions. The nvptx port of newlib does include sincos and sincosf, but not sincosl. The target hook TARGET_LIBC_HAS_FUNCTION does not distinguish between sincos, sincosf and sincosl, so if we enable it for the sincos functions, then for test.c: ... long double x, a, b; int main (void) { x = 0.5; a = sinl (x); b = cosl (x); printf ("a: %f\n", (double)a); printf ("b: %f\n", (double)b); return 0; } ... we introduce a regression: ... $ gcc test.c -lm -O2 unresolved symbol sincosl collect2: error: ld returned 1 exit status ... Add a type argument to target hook TARGET_LIBC_HAS_FUNCTION_TYPE, and use it in nvptx_libc_has_function_type to enable sincos and sincosf, but not sincosl. Build and reg-tested on x86_64-linux. Build and tested on nvptx. gcc/ChangeLog: 2020-09-28 Tobias Burnus <tobias@codesourcery.com> Tom de Vries <tdevries@suse.de> * builtins.c (expand_builtin_cexpi, fold_builtin_sincos): Update targetm.libc_has_function call. * builtins.def (DEF_C94_BUILTIN, DEF_C99_BUILTIN, DEF_C11_BUILTIN): (DEF_C2X_BUILTIN, DEF_C99_COMPL_BUILTIN, DEF_C99_C90RES_BUILTIN): Same. * config/darwin-protos.h (darwin_libc_has_function): Update prototype. * config/darwin.c (darwin_libc_has_function): Add arg. * config/linux-protos.h (linux_libc_has_function): Update prototype. * config/linux.c (linux_libc_has_function): Add arg. * config/i386/i386.c (ix86_libc_has_function): Update targetm.libc_has_function call. * config/nvptx/nvptx.c (nvptx_libc_has_function): New function. (TARGET_LIBC_HAS_FUNCTION): Redefine to nvptx_libc_has_function. * convert.c (convert_to_integer_1): Update targetm.libc_has_function call. * match.pd: Same. * target.def (libc_has_function): Add arg. * doc/tm.texi: Regenerate. * targhooks.c (default_libc_has_function, gnu_libc_has_function) (no_c99_libc_has_function): Add arg. * targhooks.h (default_libc_has_function, no_c99_libc_has_function) (gnu_libc_has_function): Update prototype. * tree-ssa-math-opts.c (pass_cse_sincos::execute): Update targetm.libc_has_function call. gcc/fortran/ChangeLog: 2020-09-30 Tom de Vries <tdevries@suse.de> * f95-lang.c (gfc_init_builtin_functions): Update targetm.libc_has_function call.
2020-09-29Daily bump.GCC Administrator1-0/+20
2020-09-28Revert "Fortran : ICE in build_field PR95614"Mark Eggleston4-14/+8
This reverts commit e5a76af3a2f3324efc60b4b2778ffb29d5c377bc.
2020-09-28Daily bump.GCC Administrator1-0/+17
2020-09-27Fortran : ICE in build_field PR95614Mark Eggleston4-8/+14
Local identifiers can not be the same as a module name. Original patch by Steve Kargl resulted in name clashes between common block names and local identifiers. A local identifier can be the same as a global identier if that identifier represents a common. The patch was modified to allow global identifiers that represent a common block. 2020-09-27 Steven G. Kargl <kargl@gcc.gnu.org> Mark Eggleston <markeggleston@gcc.gnu.org> gcc/fortran/ PR fortran/95614 * decl.c (gfc_get_common): Use gfc_match_common_name instead of match_common_name. * decl.c (gfc_bind_idents): Use gfc_match_common_name instead of match_common_name. * match.c : Rename match_common_name to gfc_match_common_name. * match.c (gfc_match_common): Use gfc_match_common_name instead of match_common_name. * match.h : Rename match_common_name to gfc_match_common_name. * resolve.c (resolve_common_vars): Check each symbol in a common block has a global symbol. If there is a global symbol issue an error if the symbol type is known as is not a common block name. 2020-09-27 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite/ PR fortran/95614 * gfortran.dg/pr95614_1.f90: New test. * gfortran.dg/pr95614_2.f90: New test.
2020-09-25Daily bump.GCC Administrator1-0/+7
2020-09-24This patch fixes PR96495 - frees result components outside loop.Paul Thomas1-1/+25
2020-24-09 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/96495 * trans-expr.c (gfc_conv_procedure_call): Take the deallocation of allocatable result components of a scalar result outside the scalarization loop. Find and use the stored result. gcc/testsuite/ PR fortran/96495 * gfortran.dg/alloc_comp_result_2.f90 : New test.
2020-09-22Daily bump.GCC Administrator1-0/+16
2020-09-21PR fortran/90903 [part2] - Add runtime checking for the MVBITS intrinsicHarald Anlauf4-24/+209
Implement inline expansion of the intrinsic elemental subroutine MVBITS with optional runtime checks for valid argument range. gcc/fortran/ChangeLog: * iresolve.c (gfc_resolve_mvbits): Remove unneeded conversion of FROMPOS, LEN and TOPOS arguments to fit a C int. * trans-intrinsic.c (gfc_conv_intrinsic_mvbits): Add inline expansion of MVBITS intrinsic elemental subroutine and add code for runtime argument checking. (gfc_conv_intrinsic_subroutine): Recognise MVBITS intrinsic, but defer handling to gfc_trans_call. * trans-stmt.c (replace_ss): (gfc_trans_call): Adjust to handle inline expansion, scalarization of intrinsic subroutine MVBITS in gfc_conv_intrinsic_mvbits. * trans.h (gfc_conv_intrinsic_mvbits): Add prototype for gfc_conv_intrinsic_mvbits. gcc/testsuite/ChangeLog: * gfortran.dg/check_bits_2.f90: New test. Co-authored-by: Paul Thomas <pault@gcc.gnu.org>
2020-09-20Daily bump.GCC Administrator1-0/+10
2020-09-19Work around bootstrap failure in Fortran front end.Sandra Loosemore1-0/+4
Switching the C++ front end to lower loops the same was as the C front end triggered this error when bootstrapping the Fortran front end: /path/to/gcc/fortran/interface.c:3546:12: error: '*new_arg' may be used uninitialized [-Werror=maybe-uninitialized] 3546 | new_arg[i]->next = NULL; | ~~~~~~~~~^ Work around this by adding an assertion, which seems appropriate for documentation and good coding practices anyway. 2020-08-12 Sandra Loosemore <sandra@codesourcery.com> gcc/fortran/ * interface.c (gfc_compare_actual_formal): Add assertion after main processing loop to silence maybe-uninitialized error.
2020-09-19PR fortran/97036 - [F2018] Allow ELEMENTAL RECURSIVE procedure prefixHarald Anlauf1-1/+1
gcc/fortran/ChangeLog: * symbol.c (gfc_check_conflict): Allow ELEMENTAL RECURSIVE procedure prefix for -std=f2018. gcc/testsuite/ChangeLog: * gfortran.dg/pr97036.f90: New test.
2020-09-18Daily bump.GCC Administrator1-0/+7
2020-09-17Fortran: Avoid double-free with parse error (PR96041, PR93423)Tobias Burnus1-0/+9
gcc/fortran/ PR fortran/96041 PR fortran/93423 * decl.c (gfc_match_submod_proc): Avoid later double-free in the error case.
2020-09-17Daily bump.GCC Administrator1-0/+5
2020-09-16Fortran: OpenMP - fix simd with (last)private (PR97061)Tobias Burnus1-14/+23
gcc/fortran/ChangeLog: PR fortran/97061 * trans-openmp.c (gfc_trans_omp_do): Handle simd with (last)private. gcc/testsuite/ChangeLog: PR fortran/97061 * gfortran.dg/gomp/openmp-simd-6.f90: New test.
2020-09-16Daily bump.GCC Administrator1-0/+9
2020-09-15OpenMP/Fortran: Fix (re)mapping of allocatable/pointer arrays [PR96668]Tobias Burnus2-4/+29
gcc/cp/ChangeLog: PR fortran/96668 * cp-gimplify.c (cxx_omp_finish_clause): Add bool openacc arg. * cp-tree.h (cxx_omp_finish_clause): Likewise * semantics.c (handle_omp_for_class_iterator): Update call. gcc/fortran/ChangeLog: PR fortran/96668 * trans.h (gfc_omp_finish_clause): Add bool openacc arg. * trans-openmp.c (gfc_omp_finish_clause): Ditto. Use GOMP_MAP_ALWAYS_POINTER with PSET for pointers. (gfc_trans_omp_clauses): Like the latter and also if the always modifier is used. gcc/ChangeLog: PR fortran/96668 * gimplify.c (gimplify_omp_for): Add 'bool openacc' argument; update omp_finish_clause calls. (gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses, gimplify_expr, gimplify_omp_loop): Update omp_finish_clause and/or gimplify_for calls. * langhooks-def.h (lhd_omp_finish_clause): Add bool openacc arg. * langhooks.c (lhd_omp_finish_clause): Likewise. * langhooks.h (lhd_omp_finish_clause): Likewise. * omp-low.c (scan_sharing_clauses): Keep GOMP_MAP_TO_PSET cause for 'declare target' vars. include/ChangeLog: PR fortran/96668 * gomp-constants.h (GOMP_MAP_ALWAYS_POINTER_P): Define. libgomp/ChangeLog: PR fortran/96668 * libgomp.h (struct target_var_desc): Add has_null_ptr_assoc member. * target.c (gomp_map_vars_existing): Add always_to_flag flag. (gomp_map_vars_existing): Update call to it. (gomp_map_fields_existing): Likewise (gomp_map_vars_internal): Update PSET handling such that if a nullptr is now allocated or if GOMP_MAP_POINTER is used PSET is updated and pointer remapped. (GOMP_target_enter_exit_data): Hanlde GOMP_MAP_ALWAYS_POINTER like GOMP_MAP_POINTER. * testsuite/libgomp.fortran/map-alloc-ptr-1.f90: New test. * testsuite/libgomp.fortran/map-alloc-ptr-2.f90: New test.
2020-09-10Daily bump.GCC Administrator1-0/+12
2020-09-09Fortran: Fixes for OpenMP loop-iter privatization (PRs 95109 + 94690)Tobias Burnus3-26/+11
This commit also fixes a gfortran.dg/gomp/target1.f90 regression; target1.f90 tests the resolve.c and openmp.c changes. gcc/fortran/ChangeLog: PR fortran/95109 PR fortran/94690 * resolve.c (gfc_resolve_code): Also call gfc_resolve_omp_parallel_blocks for 'distribute parallel do (simd)'. * openmp.c (gfc_resolve_omp_parallel_blocks): Handle it. (gfc_resolve_do_iterator): Remove special code for SIMD, which is not needed. * trans-openmp.c (gfc_trans_omp_target): For TARGET_PARALLEL_DO_SIMD, call simd not do processing function. gcc/testsuite/ChangeLog: PR fortran/95109 PR fortran/94690 * gfortran.dg/gomp/combined-if.f90: Update scan-tree-dump-times for 'omp simd.*if'. * gfortran.dg/gomp/openmp-simd-5.f90: New test.
2020-09-09Daily bump.GCC Administrator1-0/+4
2020-09-08Fix description of FINDLOC result.Thomas Koenig1-1/+2
gcc/fortran/ChangeLog: * intrinsic.texi: Fix description of FINDLOC result.
2020-09-08Daily bump.GCC Administrator1-0/+21
2020-09-07PR fortran/96711 - ICE with NINT() for integer(16) resultHarald Anlauf1-2/+15
When rounding a real to the nearest integer, temporarily convert the real argument to a longer real kind when the result is of type/kind integer(16). gcc/fortran/ChangeLog: * trans-intrinsic.c (build_round_expr): Use temporary with appropriate kind for conversion before rounding to nearest integer when the result precision is 128 bits. gcc/testsuite/ChangeLog: * gfortran.dg/pr96711.f90: New test.
2020-09-07Fortran: Fixes for pointer function call as variable (PR96896)Tobias Burnus1-1/+3
gcc/fortran/ChangeLog: PR fortran/96896 * resolve.c (get_temp_from_expr): Also reset proc_pointer + use_assoc attribute. (resolve_ptr_fcn_assign): Use information from the LHS. gcc/testsuite/ChangeLog: PR fortran/96896 * gfortran.dg/ptr_func_assign_4.f08: Update dg-error. * gfortran.dg/ptr-func-3.f90: New test.
2020-09-07fortran: Fix argument types in derived types proceduresFrancois-Xavier Coudert1-1/+1
gcc/fortran/ChangeLog * trans-types.c (gfc_get_derived_type): Fix argument types.
2020-09-07fortran: Fix arg types of _gfortran_is_extension_ofFrancois-Xavier Coudert1-0/+6
gcc/fortran/ChangeLog * resolve.c (resolve_select_type): Provide a formal arg list.
2020-09-07Daily bump.GCC Administrator1-0/+14
2020-09-06fortran: Add comment about previous commitFrancois-Xavier Coudert1-0/+2
gcc/fortran/ChangeLog * trans-types.c (gfc_get_ppc_type): Add comment.
2020-09-06fortran: Fix function arg types for class objectsFrancois-Xavier Coudert1-1/+1
gcc/fortran/ChangeLog * trans-types.c (gfc_get_ppc_type): Fix function arg types.
2020-09-06fortran: caf_fail_image expects no argumentFrancois-Xavier Coudert1-2/+1
gcc/fortran/ChangeLog PR fortran/96947 * trans-stmt.c (gfc_trans_fail_image): caf_fail_image expects no argument. gcc/testsuite/ChangeLog * gfortran.dg/coarray_fail_st.f90: Adjust test.
2020-09-03Daily bump.GCC Administrator1-0/+7
2020-09-02fortran: Fix o'...' boz to integer/real conversions [PR96859]Jakub Jelinek1-4/+4
The standard says that excess digits from boz are truncated. For hexadecimal or binary, the routines copy just the number of digits that will be needed, but for octal we copy number of digits that contain one extra bit (for 8-bit, 32-bit or 128-bit, i.e. kind 1, 4 and 16) or two extra bits (for 16-bit or 64-bit, i.e. kind 2 and 8). The clearing of the first bit is done correctly by changing the first digit if it is 4-7 to one smaller by 4 (i.e. modulo 4). The clearing of the first two bits is done by changing 4 or 6 to 0 and 5 or 7 to 1, which is incorrect, because we really want to change the first digit to 0 if it was even, or to 1 if it was odd, so digits 2 and 3 are mishandled by keeping them as is, rather than changing 2 to 0 and 3 to 1. 2020-09-02 Jakub Jelinek <jakub@redhat.com> PR fortran/96859 * check.c (gfc_boz2real, gfc_boz2int): When clearing first two bits, change also '2' to '0' and '3' to '1' rather than just handling '4' through '7'. * gfortran.dg/pr96859.f90: New test.
2020-09-02Daily bump.GCC Administrator1-0/+8
2020-09-01Fortran : ICE on invalid code PR95398Mark Eggleston1-1/+3
The CLASS_DATA macro is used to shorten the code accessing the derived components of an expressions type specification. If the type is not BT_CLASS the derived pointer is NULL resulting in an ICE. To avoid dereferencing a NULL pointer the type should be BT_CLASS. 2020-09-01 Steven G. Kargl <kargl@gcc.gnu.org> gcc/fortran PR fortran/95398 * resolve.c (resolve_select_type): Add check for BT_CLASS type before using the CLASS_DATA macro which will have a NULL pointer to derive components if it isn't BT_CLASS. 2020-09-01 Mark Eggleston <markeggleston@gcc.gnu.org> gcc/testsuite PR fortran/95398 * gfortran.dg/pr95398.f90: New test.
2020-08-31Daily bump.GCC Administrator1-0/+32
2020-08-30 2020-8-20 José Rui Faustino de Sousa <jrfsousa@gmail.com>José Rui Faustino de Sousa1-1/+41
gcc/fortran/ChangeLog: PR fortran/96728 * module.c (module_peek_char): Peek ahead function. (parse_integer): Add code for parsing signed integers. (parse_atom): Add code to handle signed integers. (peek_atom): Add code to handle signed integers. gcc/testsuite/ChangeLog: PR fortran/96728 * gfortran.dg/PR96728.f90: New test.
2020-08-30 2020-8-20 José Rui Faustino de Sousa <jrfsousa@gmail.com>José Rui Faustino de Sousa1-0/+6
gcc/fortran/ChangeLog: PR fortran/96727 * expr.c (gfc_check_init_expr): Add default error message for the AS_ASSUMED_RANK case. gcc/testsuite/ChangeLog: PR fortran/96727 * gfortran.dg/PR96727.f90: New test.
2020-08-30 2020-8-20 José Rui Faustino de Sousa <jrfsousa@gmail.com>José Rui Faustino de Sousa1-1/+1
gcc/fortran/ChangeLog: PR fortran/96726 * expr.c (check_references): Change different relational operator to less-than operator to avoid infinite loop. gcc/testsuite/ChangeLog: PR fortran/96726 * gfortran.dg/PR96726.f90: New test.