diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2020-07-21 18:29:53 +0200 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 13:18:52 -0300 |
commit | e51e5d0c6c8dd2539b3e0f54b7487a9815e10913 (patch) | |
tree | 764c35784e34909bd73c24bf2d34c98ef9c0b0b3 /libgomp | |
parent | 0c08715b948e11873ab756148374948f7eca8b01 (diff) | |
download | gcc-e51e5d0c6c8dd2539b3e0f54b7487a9815e10913.tar.gz |
OpenMP: Fixes for omp critical + hint
gcc/c-family/ChangeLog:
* c-omp.c (c_finish_omp_critical): Check for no name but
nonzero hint provided.
gcc/c/ChangeLog:
* c-parser.c (c_parser_omp_clause_hint): Require nonnegative hint clause.
(c_parser_omp_critical): Permit hint(0) clause without named critical.
(c_parser_omp_construct): Don't assert if error_mark_node is returned.
gcc/cp/ChangeLog:
* parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
(cp_parser_omp_critical): Permit hint(0) clause without named critical.
* pt.c (tsubst_expr): Re-check the latter for templates.
gcc/fortran/ChangeLog:
* openmp.c (gfc_match_omp_critical): Fix handling hints; permit
hint clause without named critical.
(resolve_omp_clauses): Require nonnegative constant integer
for the hint clause.
(gfc_resolve_omp_directive): Check for no name but
nonzero value for hint clause.
* parse.c (parse_omp_structured_block): Fix same-name check
for critical.
* trans-openmp.c (gfc_trans_omp_critical): Handle hint clause properly.
libgomp/ChangeLog:
* omp_lib.f90.in: Add omp_sync_hint_* and omp_sync_hint_kind.
* omp_lib.h.in: Likewise.
gcc/testsuite/ChangeLog:
* g++.dg/gomp/critical-3.C: Add nameless critical with hint testcase.
* c-c++-common/gomp/critical-hint-1.c: New test.
* c-c++-common/gomp/critical-hint-2.c: New test.
* gfortran.dg/gomp/critical-hint-1.f90: New test.
* gfortran.dg/gomp/critical-hint-2.f90: New test.
Diffstat (limited to 'libgomp')
-rw-r--r-- | libgomp/omp_lib.f90.in | 27 | ||||
-rw-r--r-- | libgomp/omp_lib.h.in | 16 |
2 files changed, 35 insertions, 8 deletions
diff --git a/libgomp/omp_lib.f90.in b/libgomp/omp_lib.f90.in index 666b5152a5f..b22bcbaf770 100644 --- a/libgomp/omp_lib.f90.in +++ b/libgomp/omp_lib.f90.in @@ -31,7 +31,8 @@ integer, parameter :: omp_nest_lock_kind = @OMP_NEST_LOCK_KIND@ integer, parameter :: omp_sched_kind = 4 integer, parameter :: omp_proc_bind_kind = 4 - integer, parameter :: omp_lock_hint_kind = 4 + integer, parameter :: omp_sync_hint_kind = 4 + integer, parameter :: omp_lock_hint_kind = omp_sync_hint_kind integer, parameter :: omp_pause_resource_kind = 4 integer, parameter :: omp_allocator_handle_kind = c_intptr_t integer, parameter :: omp_alloctrait_key_kind = c_int @@ -52,15 +53,29 @@ integer (omp_proc_bind_kind), & parameter :: omp_proc_bind_spread = 4 integer (omp_lock_hint_kind), & - parameter :: omp_lock_hint_none = 0 + parameter :: omp_sync_hint_none = 0 integer (omp_lock_hint_kind), & - parameter :: omp_lock_hint_uncontended = 1 + parameter :: omp_lock_hint_none = omp_sync_hint_none integer (omp_lock_hint_kind), & - parameter :: omp_lock_hint_contended = 2 + parameter :: omp_sync_hint_uncontended = 1 integer (omp_lock_hint_kind), & - parameter :: omp_lock_hint_nonspeculative = 4 + parameter :: omp_lock_hint_uncontended & + = omp_sync_hint_uncontended integer (omp_lock_hint_kind), & - parameter :: omp_lock_hint_speculative = 8 + parameter :: omp_sync_hint_contended = 2 + integer (omp_lock_hint_kind), & + parameter :: omp_lock_hint_contended & + = omp_sync_hint_contended + integer (omp_lock_hint_kind), & + parameter :: omp_sync_hint_nonspeculative = 4 + integer (omp_lock_hint_kind), & + parameter :: omp_lock_hint_nonspeculative & + = omp_sync_hint_nonspeculative + integer (omp_lock_hint_kind), & + parameter :: omp_sync_hint_speculative = 8 + integer (omp_lock_hint_kind), & + parameter :: omp_lock_hint_speculative & + = omp_sync_hint_speculative integer (kind=omp_pause_resource_kind), & parameter :: omp_pause_soft = 1 integer (kind=omp_pause_resource_kind), & diff --git a/libgomp/omp_lib.h.in b/libgomp/omp_lib.h.in index 34babe93ab9..c7d444d4a97 100644 --- a/libgomp/omp_lib.h.in +++ b/libgomp/omp_lib.h.in @@ -46,17 +46,29 @@ parameter (omp_proc_bind_master = 2) parameter (omp_proc_bind_close = 3) parameter (omp_proc_bind_spread = 4) + integer omp_sync_hint_kind integer omp_lock_hint_kind - parameter (omp_lock_hint_kind = 4) + parameter (omp_sync_hint_kind = 4) + parameter (omp_lock_hint_kind = omp_sync_hint_kind) + integer (omp_sync_hint_kind) omp_sync_hint_none integer (omp_lock_hint_kind) omp_lock_hint_none + integer (omp_sync_hint_kind) omp_sync_hint_uncontended integer (omp_lock_hint_kind) omp_lock_hint_uncontended - integer (omp_lock_hint_kind) omp_lock_hint_contended + integer (omp_sync_hint_kind) omp_sync_hint_contended + integer (omp_sync_hint_kind) omp_lock_hint_contended + integer (omp_lock_hint_kind) omp_sync_hint_nonspeculative integer (omp_lock_hint_kind) omp_lock_hint_nonspeculative + integer (omp_sync_hint_kind) omp_sync_hint_speculative integer (omp_lock_hint_kind) omp_lock_hint_speculative + parameter (omp_sync_hint_none = 0) parameter (omp_lock_hint_none = 0) + parameter (omp_sync_hint_uncontended = 1) parameter (omp_lock_hint_uncontended = 1) + parameter (omp_sync_hint_contended = 2) parameter (omp_lock_hint_contended = 2) + parameter (omp_sync_hint_nonspeculative = 4) parameter (omp_lock_hint_nonspeculative = 4) + parameter (omp_sync_hint_speculative = 8) parameter (omp_lock_hint_speculative = 8) parameter (openmp_version = 201511) integer omp_pause_resource_kind |