aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
AgeCommit message (Collapse)AuthorFilesLines
2020-12-13Show coarrays on parse tree dump, implement debug for array references.Thomas Koenig1-0/+36
gcc/fortran/ChangeLog: * dump-parse-tree.c (show_array_ref): Also show coarrays. (debug): Implement for array reference.
2020-12-13Daily bump.GCC Administrator1-0/+6
2020-12-12Fortran: Enable inquiry references in data statements [PR98022].Paul Thomas1-13/+61
2020-12-12 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/98022 * data.c (gfc_assign_data_value): Handle inquiry references in the data statement object list. gcc/testsuite/ PR fortran/98022 * gfortran.dg/data_inquiry_ref.f90: New test.
2020-12-09Daily bump.GCC Administrator1-0/+19
2020-12-08Fortran: Add 'omp scan' support of OpenMP 5.0Tobias Burnus8-17/+147
gcc/fortran/ChangeLog: * dump-parse-tree.c (show_omp_clauses, show_omp_node, show_code_node): Handle OMP SCAN. * gfortran.h (enum gfc_statement): Add ST_OMP_SCAN. (enum): Add OMP_LIST_SCAN_IN and OMP_LIST_SCAN_EX. (enum gfc_exec_op): Add EXEC_OMP_SCAN. * match.h (gfc_match_omp_scan): New prototype. * openmp.c (gfc_match_omp_scan): New. (gfc_match_omp_taskgroup): Cleanup. (resolve_omp_clauses, gfc_resolve_omp_do_blocks, omp_code_to_statement, gfc_resolve_omp_directive): Handle 'omp scan'. * parse.c (decode_omp_directive, next_statement, gfc_ascii_statement): Likewise. * resolve.c (gfc_resolve_code): Handle EXEC_OMP_SCAN. * st.c (gfc_free_statement): Likewise. * trans-openmp.c (gfc_trans_omp_clauses, gfc_trans_omp_do, gfc_split_omp_clauses): Handle 'omp scan'. libgomp/ChangeLog: * testsuite/libgomp.fortran/scan-1.f90: New test. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/reduction4.f90: Update; move FE some tests to ... * gfortran.dg/gomp/reduction6.f90: ... this new test and ... * gfortran.dg/gomp/reduction7.f90: ... this new test. * gfortran.dg/gomp/reduction5.f90: Add dg-error. * gfortran.dg/gomp/scan-1.f90: New test. * gfortran.dg/gomp/scan-2.f90: New test. * gfortran.dg/gomp/scan-3.f90: New test. * gfortran.dg/gomp/scan-4.f90: New test. * gfortran.dg/gomp/scan-5.f90: New test. * gfortran.dg/gomp/scan-6.f90: New test. * gfortran.dg/gomp/scan-7.f90: New test.
2020-12-06Daily bump.GCC Administrator1-0/+6
2020-12-05Fortran: flag formal argument before resolving an array spec [PR98016].Paul Thomas1-0/+4
2020-12-05 Paul Thomas <pault@gcc.gnu.org> gcc/fortran PR fortran/98016 * resolve.c (resolve_symbol): Set formal_arg_flag before resolving an array spec and restore value afterwards. gcc/testsuite/ PR fortran/98016 * gfortran.dg/pr98016.f90: New test.
2020-12-04Daily bump.GCC Administrator1-0/+6
2020-12-03PR fortran/95342 - ICE in gfc_match_subroutine, at fortran/decl.c:7913Harald Anlauf1-0/+2
Add checks for NULL pointers before dereferencing them. gcc/fortran/ChangeLog: PR fortran/95342 * decl.c (gfc_match_function_decl): Avoid NULL pointer dereference. (gfc_match_subroutine): Likewise. gcc/testsuite/ChangeLog: PR fortran/95342 * gfortran.dg/pr95342.f90: New test.
2020-12-01Daily bump.GCC Administrator1-0/+19
2020-11-30Fortran: With OpenACC, ignore OpenMP's cond comp sentinelsTobias Burnus1-21/+11
gcc/fortran/ChangeLog: PR fortran/98011 * scanner.c (skip_free_comments, skip_fixed_comments): If only -fopenacc but not -fopenmp is used, ignore OpenMP's conditional compilation sentinels. Fix indentation, use 'else if' for readability. gcc/testsuite/ChangeLog: PR fortran/98011 * gfortran.dg/goacc/sentinel-free-form.f95: * gfortran.dg/goacc-gomp/fixed-1.f: New test. * gfortran.dg/goacc-gomp/free-1.f90: New test. * gfortran.dg/goacc/fixed-5.f: New test.
2020-11-30Fortran: -fno-automatic and -fopenacc / recusion check cleanupTobias Burnus2-9/+10
Options: -fopenmp and -fopenacc imply concurrent calls to a procedure; now also -fopenacc implies -frecursive, disabling that larger local const-size array variables use static memory. Run-time recursion check: Always reset the check variable at the end of the procedure; this avoids a bogus error with -fopenmp when called twice nonconcurrently/nonrecursively. (Issue requires using -fno-automatic or -fmax-stack-var-size= to trigger.) gcc/fortran/ChangeLog: PR fortran/98010 PR fortran/98013 * options.c (gfc_post_options): Also imply recursive with -fopenacc. * trans-decl.c (gfc_generate_function_code): Simplify condition.
2020-11-30Fortran's dump-parse-tree.c: Use '==' not '=' for '.eq.'.Tobias Burnus1-1/+1
gcc/fortran/ * dump-parse-tree.c (show_expr): Use '==' not '=' for '.eq.'.
2020-11-30Daily bump.GCC Administrator1-0/+5
2020-11-29PR fortran/98017 - Suspected regression using PACKHarald Anlauf1-0/+3
When substituting a parameter variable of type character, the character length was reset to 1. Fix this by copying the length. gcc/fortran/ChangeLog: * expr.c (simplify_parameter_variable): Fix up character length after copying an array-valued expression. gcc/testsuite/ChangeLog: * gfortran.dg/pr98017.f90: New test.
2020-11-29Daily bump.GCC Administrator1-0/+18
2020-11-28Generate correct fn specs for some Fortran library functions.Thomas Koenig5-10/+98
This patch works by generating the correct fn spec from the actual arguments in specific_intrinsic_symbol, and by passing this down via gfc_get_extern_function_decl to gfc_get_function_type. CSHIFT remains to be done. gcc/fortran/ChangeLog: PR fortran/97454 * trans-decl.c (gfc_get_extern_function_decl): Add argument fnspec. * trans-intrinsic.c (MAX_SPEC_ARG): Define. (intrinsic_fnspec): New function. (ADD_CHAR): Define. (specific_intrinsic_symbol): Adjust comment. Pass fn spec to gfc_get_extern_function_decl. (gfc_conv_intrinsic_funcall): Add ANY, ALL, NORM2, PRODUCT and SUM intrnisic. Add FIXME for cshift et al. * trans-types.c (gfc_get_function_type): Add fnspec argument, handle it. * trans-types.h (gfc_get_function_type): Add optinal fnspec argument. * trans.h (gfc_get_extern_function_decl): Likewise.
2020-11-26Daily bump.GCC Administrator1-0/+6
2020-11-25PR fortran/85796 - Floating point exception with implied doHarald Anlauf1-2/+9
Catch invalid step=0 in implied do loop within data statements. gcc/fortran/ChangeLog: PR fortran/85796 * resolve.c (traverse_data_list): Fix copy&paste errors; catch step=0 in implied do loop. gcc/testsuite/ChangeLog: PR fortran/85796 * gfortran.dg/pr85796.f90: New test.
2020-11-21Daily bump.GCC Administrator1-0/+8
2020-11-20configury: Fix up --enable-link-serialization supportJakub Jelinek1-3/+3
Eric reported that the --enable-link-serialization changes seemed to cause the binaries to be always relinked, for example from the gcc/ directory of the build tree: make [relink of gnat1, brig1, cc1plus, d21, f951, go1, lto1, ...] make [relink of gnat1, brig1, cc1plus, d21, f951, go1, lto1, ...] Furthermore as reported in PR, it can cause problems during make install where make install rebuilds the binaries again. The problem is that for make .PHONY targets are just "rebuilt" always, so it is very much undesirable for the cc1plus$(exeext) etc. dependencies to include .PHONY targets, but I was using them - cc1plus.prev which would depend on some *.serial and e.g. cc1.serial depending on c and c depending on cc1$(exeext). The following patch rewrites this so that *.serial and *.prev aren't .PHONY targets, but instead just make variables. I was worried that the order in which the language makefile fragments are included (which is quite random, what order we get from the filesystem matching */config-lang.in) would be a problem but it seems to work fine - as it uses make = rather than := variables, later definitions are just fine for earlier uses as long as the uses aren't needed during the makefile parsing, but only in the dependencies of make targets and in their commands. 2020-11-20 Jakub Jelinek <jakub@redhat.com> PR other/97911 gcc/ * configure.ac: In SERIAL_LIST use lang words without .serial suffix. Change $lang.prev from a target to variable and instead of depending on *.serial expand to the *.serial variable if the word is in the SERIAL_LIST at all, otherwise to nothing. * configure: Regenerated. gcc/c/ * Make-lang.in (c.serial): Change from goal to a variable. (.PHONY): Drop c.serial. gcc/ada/ * gcc-interface/Make-lang.in (ada.serial): Change from goal to a variable. (.PHONY): Drop ada.serial and ada.prev. (gnat1$(exeext)): Depend on $(ada.serial) rather than ada.serial. gcc/brig/ * Make-lang.in (brig.serial): Change from goal to a variable. (.PHONY): Drop brig.serial and brig.prev. (brig1$(exeext)): Depend on $(brig.serial) rather than brig.serial. gcc/cp/ * Make-lang.in (c++.serial): Change from goal to a variable. (.PHONY): Drop c++.serial and c++.prev. (cc1plus$(exeext)): Depend on $(c++.serial) rather than c++.serial. gcc/d/ * Make-lang.in (d.serial): Change from goal to a variable. (.PHONY): Drop d.serial and d.prev. (d21$(exeext)): Depend on $(d.serial) rather than d.serial. gcc/fortran/ * Make-lang.in (fortran.serial): Change from goal to a variable. (.PHONY): Drop fortran.serial and fortran.prev. (f951$(exeext)): Depend on $(fortran.serial) rather than fortran.serial. gcc/go/ * Make-lang.in (go.serial): Change from goal to a variable. (.PHONY): Drop go.serial and go.prev. (go1$(exeext)): Depend on $(go.serial) rather than go.serial. gcc/jit/ * Make-lang.in (jit.serial): Change from goal to a variable. (.PHONY): Drop jit.serial and jit.prev. ($(LIBGCCJIT_FILENAME)): Depend on $(jit.serial) rather than jit.serial. gcc/lto/ * Make-lang.in (lto1.serial, lto2.serial): Change from goals to variables. (.PHONY): Drop lto1.serial, lto2.serial, lto1.prev and lto2.prev. ($(LTO_EXE)): Depend on $(lto1.serial) rather than lto1.serial. ($(LTO_DUMP_EXE)): Depend on $(lto2.serial) rather than lto2.serial. gcc/objc/ * Make-lang.in (objc.serial): Change from goal to a variable. (.PHONY): Drop objc.serial and objc.prev. (cc1obj$(exeext)): Depend on $(objc.serial) rather than objc.serial. gcc/objcp/ * Make-lang.in (obj-c++.serial): Change from goal to a variable. (.PHONY): Drop obj-c++.serial and obj-c++.prev. (cc1objplus$(exeext)): Depend on $(obj-c++.serial) rather than obj-c++.serial.
2020-11-19Daily bump.GCC Administrator1-0/+6
2020-11-18configury: --enable-link-serialization supportJakub Jelinek1-3/+5
When performing LTO bootstraps, especially when using tmpfs for /tmp, one can run a machine to halt when using higher levels of parallelism and a large number of FEs, because there are too many concurrent LTO link commands running at the same time and each one of them puts most of the middle-end/backend objects into /tmp. We have --enable-link-mutex configure option, but --enable-link-mutex has a big problem that it decreases number of available jobs by the number of link commands waiting for the lock, so e.g. when doing make -j32 build with 11 different big programs linked with $(LLINKER) we end up with just 22 effective jobs, and with e.g. make -j8 with those 11 different big programs we actually most likely serialize everything during linking onto a single job. The following patch implements a new configure option, --enable-link-serialization, which implements different serialization and as it doesn't use the mutex, just modifying the old option to be implemented differently would be strange. We can deprecate and later remove the old option. The new option doesn't use any shell mutexes, but uses make dependencies. The option is implemented inside of gcc/ configure and Makefiles, which means that even inside of gcc/ make all (as well as e.g. make lto-dump) will serialize and build all previous large binaries when configured this way. One can always make -j32 cc1 DO_LINK_SERIALIZATION= to avoid that. Furthermore, I've implemented the idea I wrote about, so that --enable-link-serialization is the same as --enable-link-serialization=1 and means the large link commands are serialized, one can (the default) --disable-link-serialization which will cause all links to be parallelizable, but one can also --enable-link-serialization=3 etc. which says that at most 3 of the large link commands can run concurrently. And finally I've implemented (only if the serialization is enabled) simple progress bars for the linking. With --enable-link-serialization and e.g. the 5 large links I have in my current tree (cc1, cc1plus, f951, lto1 and lto-dump), before the linking it prints Linking |==-- | 20% and after it Linking |==== | 40% (each == characters stand for already finished links, each -- characters stand for the link being started). With --enable-link-serialization=3 it will change the way the start is printed, one will get: Linking |-- | 0% at the start of cc1 link, Linking |>>-- | 0% at the start of the second large link and Linking |>>>>-- | 0% at the start of the third large link, where the >> characters stand for already pending links. The printing at the end of link command is the same as with the full serialization, i.e. for the above 3: Linking |== | 20% Linking |==== | 40% Linking |====== | 60% but one could actually get them in any order depending on which of those 3 finishes first - to get it 100% accurate I'd need to add some directory with files representing finished links or similar, doesn't seem worth it. 2020-11-18 Jakub Jelinek <jakub@redhat.com> gcc/ * configure.ac: Add $lang.prev rules, INDEX.$lang and SERIAL_LIST and SERIAL_COUNT variables to Make-hooks. (--enable-link-serialization): New configure option. * Makefile.in (DO_LINK_SERIALIZATION, LINK_PROGRESS): New variables. * doc/install.texi (--enable-link-serialization): Document. * configure: Regenerated. gcc/c/ * Make-lang.in (c.serial): New goal. (.PHONY): Add c.serial c.prev. (cc1$(exeext)): Call LINK_PROGRESS. gcc/cp/ * Make-lang.in (c++.serial): New goal. (.PHONY): Add c++.serial c++.prev. (cc1plus$(exeext)): Depend on c++.prev. Call LINK_PROGRESS. gcc/fortran/ * Make-lang.in (fortran.serial): New goal. (.PHONY): Add fortran.serial fortran.prev. (f951$(exeext)): Depend on fortran.prev. Call LINK_PROGRESS. gcc/lto/ * Make-lang.in (lto, lto1.serial, lto2.serial): New goals. (.PHONY): Add lto lto1.serial lto1.prev lto2.serial lto2.prev. (lto.all.cross, lto.start.encap): Remove dependencies. ($(LTO_EXE)): Depend on lto1.prev. Call LINK_PROGRESS. ($(LTO_DUMP_EXE)): Depend on lto2.prev. Call LINK_PROGRESS. gcc/objc/ * Make-lang.in (objc.serial): New goal. (.PHONY): Add objc.serial objc.prev. (cc1obj$(exeext)): Depend on objc.prev. Call LINK_PROGRESS. gcc/objcp/ * Make-lang.in (obj-c++.serial): New goal. (.PHONY): Add obj-c++.serial obj-c++.prev. (cc1objplus$(exeext)): Depend on obj-c++.prev. Call LINK_PROGRESS. gcc/ada/ * gcc-interface/Make-lang.in (ada.serial): New goal. (.PHONY): Add ada.serial ada.prev. (gnat1$(exeext)): Depend on ada.prev. Call LINK_PROGRESS. gcc/brig/ * Make-lang.in (brig.serial): New goal. (.PHONY): Add brig.serial brig.prev. (brig1$(exeext)): Depend on brig.prev. Call LINK_PROGRESS. gcc/go/ * Make-lang.in (go.serial): New goal. (.PHONY): Add go.serial go.prev. (go1$(exeext)): Depend on go.prev. Call LINK_PROGRESS. gcc/jit/ * Make-lang.in (jit.serial): New goal. (.PHONY): Add jit.serial jit.prev. ($(LIBGCCJIT_FILENAME)): Depend on jit.prev. Call LINK_PROGRESS. gcc/d/ * Make-lang.in (d.serial): New goal. (.PHONY): Add d.serial d.prev. (d21$(exeext)): Depend on d.prev. Call LINK_PROGRESS.
2020-11-18Daily bump.GCC Administrator1-0/+5
2020-11-17Fortran texi: Fix description of GFC_RTCHECK_* macros.Harald Anlauf1-2/+2
gcc/fortran/ChangeLog: * gfortran.texi: Fix description of GFC_RTCHECK_* to match actual code.
2020-11-17Daily bump.GCC Administrator1-0/+5
2020-11-16PR fortran/48958 - Add runtime diagnostics for SIZE intrinsic functionHarald Anlauf1-0/+29
Add code for runtime checking of status of ALLOCATABLE and POINTER arguments to the SIZE intrinsic when -fcheck=pointer is specified. gcc/fortran/ChangeLog: * trans-intrinsic.c (gfc_conv_intrinsic_size): Generate runtime checking code for status of argument. gcc/testsuite/ChangeLog: * gfortran.dg/pr48958.f90: New test.
2020-11-14Daily bump.GCC Administrator1-0/+5
2020-11-13Decompose OpenACC 'kernels' constructs into parts, a sequence of compute ↵Gergö Barany1-0/+4
constructs Not yet enabled by default: for now, the current mode of OpenACC 'kernels' constructs handling still remains '-fopenacc-kernels=parloops', but that is to change later. gcc/ * omp-oacc-kernels-decompose.cc: New. * Makefile.in (OBJS): Add it. * passes.def: Instantiate it. * tree-pass.h (make_pass_omp_oacc_kernels_decompose): Declare. * flag-types.h (enum openacc_kernels): Add. * doc/invoke.texi (-fopenacc-kernels): Document. * gimple.h (enum gf_mask): Add 'GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_PARALLELIZED', 'GF_OMP_TARGET_KIND_OACC_PARALLEL_KERNELS_GANG_SINGLE', 'GF_OMP_TARGET_KIND_OACC_DATA_KERNELS'. (is_gimple_omp_oacc, is_gimple_omp_offloaded): Handle these. * gimple-pretty-print.c (dump_gimple_omp_target): Likewise. * omp-expand.c (expand_omp_target, build_omp_regions_1) (omp_make_gimple_edges): Likewise. * omp-low.c (scan_sharing_clauses, scan_omp_for) (check_omp_nesting_restrictions, lower_oacc_reductions) (lower_oacc_head_mark, lower_omp_target): Likewise. * omp-offload.c (execute_oacc_device_lower): Likewise. gcc/c-family/ * c.opt (fopenacc-kernels): Add. gcc/fortran/ * lang.opt (fopenacc-kernels): Add. gcc/testsuite/ * c-c++-common/goacc/kernels-decompose-1.c: New. * c-c++-common/goacc/kernels-decompose-2.c: New. * c-c++-common/goacc/kernels-decompose-ice-1.c: New. * c-c++-common/goacc/kernels-decompose-ice-2.c: New. * gfortran.dg/goacc/kernels-decompose-1.f95: New. * gfortran.dg/goacc/kernels-decompose-2.f95: New. * c-c++-common/goacc/if-clause-2.c: Adjust. * gfortran.dg/goacc/kernels-tree.f95: Likewise. libgomp/ * testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose-ice-1.c: New. * testsuite/libgomp.oacc-c-c++-common/declare-vla-kernels-decompose.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/kernels-decompose-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/declare-vla.c: Adjust. * testsuite/libgomp.oacc-fortran/pr94358-1.f90: Likewise. Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
2020-11-13Daily bump.GCC Administrator1-0/+21
2020-11-12openmp: Implement allocate clause in omp lowering.Jakub Jelinek2-1/+15
For now, task/taskloop constructs aren't handled and C/C++ array reductions and reductions with task or inscan modifiers need further work. Instead of calling omp_alloc/omp_free (where the former doesn't have alignment argument and omp_aligned_alloc is 5.1 only feature), this calls GOMP_alloc/GOMP_free, so that the library can fail if it would fall back into NULL (exception is zero length allocations). 2020-11-12 Jakub Jelinek <jakub@redhat.com> gcc/ * builtin-types.def (BT_FN_PTR_SIZE_SIZE_PTRMODE): New function type. * omp-builtins.def (BUILT_IN_GOACC_DECLARE): Move earlier. (BUILT_IN_GOMP_ALLOC, BUILT_IN_GOMP_FREE): New builtins. * gimplify.c (gimplify_scan_omp_clauses): Force allocator into a decl if it is not NULL, INTEGER_CST or decl. (gimplify_adjust_omp_clauses): Clear GOVD_EXPLICIT on explicit clauses which are being removed. Remove allocate clauses for variables not seen if they are private, firstprivate or linear too. Call omp_notice_variable on the allocator otherwise. (gimplify_omp_for): Handle iterator vars mentioned in allocate clauses similarly to non-is_gimple_reg iterators. * omp-low.c (struct omp_context): Add allocate_map field. (delete_omp_context): Delete it. (scan_sharing_clauses): Fill it from allocate clauses. Remove it if mentioned also in shared clause. (lower_private_allocate): New function. (lower_rec_input_clauses): Handle allocate clause for privatized variables, except for task/taskloop, C/C++ array reductions for now and task/inscan variables. (lower_send_shared_vars): Don't consider variables in allocate_map as shared. * omp-expand.c (expand_omp_for_generic, expand_omp_for_static_nochunk, expand_omp_for_static_chunk): Use expand_omp_build_assign instead of gimple_build_assign + gsi_insert_after. * builtins.c (builtin_fnspec): Handle BUILTIN_GOMP_ALLOC and BUILTIN_GOMP_FREE. * tree-ssa-ccp.c (evaluate_stmt): Handle BUILTIN_GOMP_ALLOC. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Handle BUILTIN_GOMP_ALLOC. (mark_all_reaching_defs_necessary_1): Handle BUILTIN_GOMP_ALLOC and BUILTIN_GOMP_FREE. (propagate_necessity): Likewise. gcc/fortran/ * f95-lang.c (ATTR_ALLOC_WARN_UNUSED_RESULT_SIZE_2_NOTHROW_LIST): Define. (gfc_init_builtin_functions): Add alloc_size and warn_unused_result attributes to __builtin_GOMP_alloc. * types.def (BT_PTRMODE): New primitive type. (BT_FN_VOID_PTR_PTRMODE, BT_FN_PTR_SIZE_SIZE_PTRMODE): New function types. libgomp/ * libgomp.map (GOMP_alloc, GOMP_free): Export at GOMP_5.0.1. * omp.h.in (omp_alloc): Add malloc and alloc_size attributes. * libgomp_g.h (GOMP_alloc, GOMP_free): Declare. * allocator.c (omp_aligned_alloc): New for now static function, add alignment argument and handle it. (omp_alloc): Reimplement using omp_aligned_alloc. (GOMP_alloc, GOMP_free): New functions. (omp_free): Add ialias. * testsuite/libgomp.c-c++-common/allocate-1.c: New test. * testsuite/libgomp.c++/allocate-1.C: New test.
2020-11-12Fortran: improve location data for OpenACC/OpenMP directives [PR97782]Tobias Burnus1-24/+26
gcc/fortran/ChangeLog: PR fortran/97782 * trans-openmp.c (gfc_trans_oacc_construct, gfc_trans_omp_parallel_do, gfc_trans_omp_parallel_do_simd, gfc_trans_omp_parallel_sections, gfc_trans_omp_parallel_workshare, gfc_trans_omp_sections gfc_trans_omp_single, gfc_trans_omp_task, gfc_trans_omp_teams gfc_trans_omp_target, gfc_trans_omp_target_data, gfc_trans_omp_workshare): Use code->loc instead of input_location when building the OMP_/OACC_ construct. gcc/testsuite/ChangeLog: PR fortran/97782 * gfortran.dg/goacc/classify-kernels-unparallelized.f95: Move dg-message one line up. * gfortran.dg/goacc/classify-kernels.f95: Likewise.
2020-11-12Daily bump.GCC Administrator1-0/+9
2020-11-11fortran: Fix up gfc_typename CHARACTER length handling [PR97768]Jakub Jelinek1-3/+25
The first testcase below ICEs when f951 is 32-bit (or 64-bit big-endian). The problem is that ex->ts.u.cl && ex->ts.u.cl->length are both non-NULL, but ex->ts.u.cl->length->expr_type is not EXPR_CONSTANT, but EXPR_FUNCTION. value.function.actual and value.function.name are in that case pointers, but value._mp_alloc and value._mp_size are 4 byte integers no matter what. So, in 64-bit little-endian the function returns most of the time incorrect CHARACTER(0) because the most significant 32 bits of the value.function.actual pointer are likely 0. Anyway, the following patch is an attempt to get all the cases right. Uses ex->value.character.length only for ex->expr_type == EXPR_CONSTANT (i.e. CHARACTER literals), handles the deferred lengths, assumed lengths, known constant lengths and finally if the length is something other, just doesn't print it, i.e. prints just CHARACTER (for default kind) or CHARACTER(KIND=4) (for e.g. kind 4). 2020-11-11 Jakub Jelinek <jakub@redhat.com> PR fortran/97768 gcc/fortran/ * misc.c (gfc_typename): Use ex->value.character.length only if ex->expr_type == EXPR_CONSTANT. If ex->ts.deferred, print : instead of length. If ex->ts.u.cl && ex->ts.u.cl->length == NULL, print * instead of length. Otherwise if character length is non-constant, print just CHARACTER or CHARACTER(KIND=N). gcc/testsuite/ * gfortran.dg/pr97768_1.f90: New test. * gfortran.dg/pr97768_2.f90: New test.
2020-11-11Daily bump.GCC Administrator1-0/+28
2020-11-10Fortran: OpenMP 5.0 (in_,task_)reduction clause extensionsTobias Burnus4-165/+297
gcc/fortran/ChangeLog: * dump-parse-tree.c (show_omp_clauses): Handle new reduction enums. * gfortran.h (OMP_LIST_REDUCTION_INSCAN, OMP_LIST_REDUCTION_TASK, OMP_LIST_IN_REDUCTION, OMP_LIST_TASK_REDUCTION): Add enums. * openmp.c (enum omp_mask1): Add OMP_CLAUSE_IN_REDUCTION and OMP_CLAUSE_TASK_REDUCTION. (gfc_match_omp_clause_reduction): Extend reduction handling; moved from ... (gfc_match_omp_clauses): ... here. Add calls to it. (OMP_TASK_CLAUSES, OMP_TARGET_CLAUSES, OMP_TASKLOOP_CLAUSES): Add OMP_CLAUSE_IN_REDUCTION. (gfc_match_omp_taskgroup): Add task_reduction matching. (resolve_omp_clauses): Update for new reduction clause changes; remove removed nonmonotonic-schedule restrictions. (gfc_resolve_omp_parallel_blocks): Add new enums to switch. * trans-openmp.c (gfc_omp_clause_default_ctor, gfc_trans_omp_reduction_list, gfc_trans_omp_clauses, gfc_split_omp_clauses): Handle updated reduction clause. gcc/ChangeLog: * gimplify.c (gimplify_scan_omp_clauses, gimplify_omp_loop): Use 'do' instead of 'for' in error messages for Fortran. * omp-low.c (check_omp_nesting_restrictions): Likewise gcc/testsuite/ChangeLog: * gfortran.dg/gomp/schedule-modifiers-2.f90: Remove some dg-error. * gfortran.dg/gomp/reduction4.f90: New test. * gfortran.dg/gomp/reduction5.f90: New test. * gfortran.dg/gomp/workshare-reduction-1.f90: New test. * gfortran.dg/gomp/workshare-reduction-2.f90: New test. * gfortran.dg/gomp/workshare-reduction-3.f90: New test. * gfortran.dg/gomp/workshare-reduction-4.f90: New test. * gfortran.dg/gomp/workshare-reduction-5.f90: New test. * gfortran.dg/gomp/workshare-reduction-6.f90: New test. * gfortran.dg/gomp/workshare-reduction-7.f90: New test. * gfortran.dg/gomp/workshare-reduction-8.f90: New test. * gfortran.dg/gomp/workshare-reduction-9.f90: New test. * gfortran.dg/gomp/workshare-reduction-10.f90: New test. * gfortran.dg/gomp/workshare-reduction-11.f90: New test. * gfortran.dg/gomp/workshare-reduction-12.f90: New test. * gfortran.dg/gomp/workshare-reduction-13.f90: New test. * gfortran.dg/gomp/workshare-reduction-14.f90: New test. * gfortran.dg/gomp/workshare-reduction-15.f90: New test. * gfortran.dg/gomp/workshare-reduction-16.f90: New test. * gfortran.dg/gomp/workshare-reduction-17.f90: New test. * gfortran.dg/gomp/workshare-reduction-18.f90: New test. * gfortran.dg/gomp/workshare-reduction-19.f90: New test. * gfortran.dg/gomp/workshare-reduction-20.f90: New test. * gfortran.dg/gomp/workshare-reduction-21.f90: New test. * gfortran.dg/gomp/workshare-reduction-22.f90: New test. * gfortran.dg/gomp/workshare-reduction-23.f90: New test. * gfortran.dg/gomp/workshare-reduction-24.f90: New test. * gfortran.dg/gomp/workshare-reduction-25.f90: New test. * gfortran.dg/gomp/workshare-reduction-26.f90: New test. * gfortran.dg/gomp/workshare-reduction-27.f90: New test. * gfortran.dg/gomp/workshare-reduction-28.f90: New test. * gfortran.dg/gomp/workshare-reduction-29.f90: New test. * gfortran.dg/gomp/workshare-reduction-30.f90: New test. * gfortran.dg/gomp/workshare-reduction-31.f90: New test. * gfortran.dg/gomp/workshare-reduction-32.f90: New test. * gfortran.dg/gomp/workshare-reduction-33.f90: New test. * gfortran.dg/gomp/workshare-reduction-34.f90: New test. * gfortran.dg/gomp/workshare-reduction-35.f90: New test. * gfortran.dg/gomp/workshare-reduction-36.f90: New test. * gfortran.dg/gomp/workshare-reduction-37.f90: New test. * gfortran.dg/gomp/workshare-reduction-38.f90: New test. * gfortran.dg/gomp/workshare-reduction-39.f90: New test. * gfortran.dg/gomp/workshare-reduction-40.f90: New test. * gfortran.dg/gomp/workshare-reduction-41.f90: New test. * gfortran.dg/gomp/workshare-reduction-42.f90: New test. * gfortran.dg/gomp/workshare-reduction-43.f90: New test. * gfortran.dg/gomp/workshare-reduction-44.f90: New test. * gfortran.dg/gomp/workshare-reduction-45.f90: New test. * gfortran.dg/gomp/workshare-reduction-46.f90: New test. * gfortran.dg/gomp/workshare-reduction-47.f90: New test. * gfortran.dg/gomp/workshare-reduction-48.f90: New test. * gfortran.dg/gomp/workshare-reduction-49.f90: New test. * gfortran.dg/gomp/workshare-reduction-50.f90: New test. * gfortran.dg/gomp/workshare-reduction-51.f90: New test. * gfortran.dg/gomp/workshare-reduction-52.f90: New test. * gfortran.dg/gomp/workshare-reduction-53.f90: New test. * gfortran.dg/gomp/workshare-reduction-54.f90: New test. * gfortran.dg/gomp/workshare-reduction-55.f90: New test. * gfortran.dg/gomp/workshare-reduction-56.f90: New test. * gfortran.dg/gomp/workshare-reduction-57.f90: New test. * gfortran.dg/gomp/workshare-reduction-58.f90: New test.
2020-11-10Fortran: Fix function decl's location [PR95847]Tobias Burnus1-9/+10
gcc/fortran/ChangeLog: PR fortran/95847 * trans-decl.c (gfc_get_symbol_decl): Do not (re)set the location of an external procedure. (build_entry_thunks, generate_coarray_init, create_main_function, gfc_generate_function_code): Use fndecl's location in BIND_EXPR. gcc/testsuite/ChangeLog: PR fortran/95847 * gfortran.dg/coverage.f90: New test.
2020-11-10Daily bump.GCC Administrator1-0/+7
2020-11-09Fortran: Fix OpenACC in specification-part checks [PR90111]Tobias Burnus1-5/+6
OpenACC's routine and declare directives can appear anywhere in the specification part, i.e. before/after use-stmts, import-stmt, implicit-part, or declaration-constructs. gcc/fortran/ChangeLog: PR fortran/90111 * parse.c (case_decl): Move ST_OACC_ROUTINE and ST_OACC_DECLARE to ... (case_omp_decl): ... here. (verify_st_order): Update comment. gcc/testsuite/ChangeLog: PR fortran/90111 * gfortran.dg/goacc/specification-part.f90: New test.
2020-11-07Daily bump.GCC Administrator1-0/+15
2020-11-06[Fortran] Remove OpenACC 'loop' inside 'parallel' special-case codeThomas Schwinge1-37/+0
Instead, use the generic middle-end code, like already used for Fortran OpenACC 'loop' inside other compute constructs, orphaned 'loop' constructs, and C, C++ generally. gcc/fortran/ * openmp.c (oacc_is_parallel, resolve_oacc_params_in_parallel): Remove. (resolve_oacc_loop_blocks): Don't call the former. gcc/testsuite/ * gfortran.dg/goacc/loop-2-parallel-3.f95: Adjust.
2020-11-06OpenACC/Fortran: Reject '!$acc atomic update capture'Tobias Burnus1-5/+2
gcc/fortran/ChangeLog: * openmp.c (gfc_match_oacc_atomic): No longer accept 'update capture'. gcc/testsuite/ChangeLog: * gfortran.dg/goacc-gomp/goacc-gomp.exp: New. * gfortran.dg/goacc-gomp/atomic.f90: New test. * gfortran.dg/goacc/atomic.f90: New test.
2020-11-06Fortran: Fix type-decl for PDT / wrong-code pdt_14.f03 issue [PR97652]Tobias Burnus1-0/+3
Parameterized derived types are handled in a special way and start with 'Pdt'. If the 'P' is not uppercase, gfc_get_derived_type (which calls gfc_get_module_backend_decl) does not find the existing declaration and builds a new type. The middle end then sees those types as being different and nonalising, creating an endless loop for pdt_14.f03. gcc/fortran/ChangeLog: PR fortran/97652 * module.c (mio_symbol): Fix symbol name for pdt_type.
2020-11-04Daily bump.GCC Administrator1-0/+23
2020-11-03libcpp: dependency emission tidyingNathan Sidwell1-4/+6
This patch cleans up the interface to the dependency generation a little. We now only check the option in one place, and the cpp_get_deps function returns nullptr if there are no dependencies. I also reworded the -MT and -MQ help text to be make agnostic -- as there are ideas about emitting, say, JSON. libcpp/ * include/mkdeps.h: Include cpplib.h (deps_write): Adjust first parm type. * mkdeps.c: Include internal.h (make_write): Adjust first parm type. Check phony option directly. (deps_write): Adjust first parm type. * init.c (cpp_read_main_file): Use get_deps. * directives.c (cpp_get_deps): Check option before initializing. gcc/c-family/ * c.opt (MQ,MT): Reword description to be make-agnostic. gcc/fortran/ * cpp.c (gfc_cpp_add_dep): Only add dependency if we're recording them. (gfc_cpp_init): Likewise for target.
2020-11-03Fortran: Add !GCC$ attributes DEPRECATEDTobias Burnus5-1/+26
gcc/fortran/ChangeLog: * decl.c (ext_attr_list): Add EXT_ATTR_DEPRECATED. * gfortran.h (ext_attr_id_t): Ditto. * gfortran.texi (GCC$ ATTRIBUTES): Document it. * resolve.c (resolve_variable, resolve_function, resolve_call, resolve_values): Show -Wdeprecated-declarations warning. * trans-decl.c (add_attributes_to_decl): Skip those with no middle_end_name. gcc/testsuite/ChangeLog: * gfortran.dg/attr_deprecated.f90: New test.
2020-11-03[Fortran] More precise location information for OpenACC 'gang', 'worker', ↵Thomas Schwinge1-14/+26
'vector' clauses with argument [PR92793] gcc/fortran/ PR fortran/92793 * trans-openmp.c (gfc_trans_omp_clauses): More precise location information for OpenACC 'gang', 'worker', 'vector' clauses with argument. gcc/testsuite/ PR fortran/92793 * gfortran.dg/goacc/pr92793-1.f90: Adjust.
2020-11-02Daily bump.GCC Administrator1-0/+41
2020-11-02Further improve Fortran column location information [PR92793]Thomas Schwinge1-2/+5
Building on top of commit 9c81750c5bedd7883182ee2684a012c6210ebe1d "Fortran] PR 92793 - fix column used for error diagnostic", there is another place where we have to use 'gfc_get_location' returning column-corrected locations. For example, this improves column location information for OMP constructs. gcc/fortran/ PR fortran/92793 * trans.c (gfc_set_backend_locus): Use 'gfc_get_location'. (gfc_restore_backend_locus): Adjust. gcc/testsuite/ PR fortran/92793 * gfortran.dg/goacc/pr92793-1.f90: Adjust.
2020-11-02Fortran: OpenMP - fixes for omp atomic [PR97655]Tobias Burnus1-9/+11
gcc/fortran/ChangeLog: PR fortran/97655 * openmp.c (gfc_match_omp_atomic): Fix mem-order handling; reject specifying update + capture together. gcc/testsuite/ChangeLog: PR fortran/97655 * gfortran.dg/gomp/atomic.f90: Update tree-dump counts; move invalid OMP 5.0 code to ... * gfortran.dg/gomp/atomic-2.f90: ... here; update dg-error. * gfortran.dg/gomp/requires-9.f90: Update tree dump scan.