From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DE12C3858D1E; Sat, 8 Apr 2023 20:34:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DE12C3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1680986042; bh=kPEd0Dl5wuD9sgPmi5e1yijUxAa5vqDAKGQHemVcI9o=; h=From:To:Subject:Date:From; b=pMmfTqWonsTS/4LIpM67BSNifleAc+H58edLODL+ZPouZ64OCGd+9LZHfy7/mVZEe lLmPt8AHKckCAegCFYs/2lapjPVkdw7B7l1CPlP07yQWcPI9fZBav5j7C1F0vdIkyc tQuvrx2Uz6zxaMtJ9fdwHT5zBCj2SHsqCI71raGM= From: "grg-webvisible+gcc.gnu.org at ai dot mit.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgomp/109452] New: omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() are undefined Date: Sat, 08 Apr 2023 20:34:02 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgomp X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: grg-webvisible+gcc.gnu.org at ai dot mit.edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109452 Bug ID: 109452 Summary: omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() are undefined Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: grg-webvisible+gcc.gnu.org at ai dot mit.edu CC: jakub at gcc dot gnu.org Target Milestone: --- omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() appear to be declared but not defined: #include int main() { omp_lock_t lock; omp_init_lock_with_hint(&lock, omp_sync_hint_none); } compiled with: gcc -fopenmp main.cpp fails to link: In function `main': main.cpp:(.text+0x15): undefined reference to `omp_init_lock_with_hint' collect2: error: ld returned 1 exit status on v12.1.0: GNU C++17 (GCC) version 12.1.0 (x86_64-pc-linux-gnu) compiled by GNU C version 12.1.0, GMP version 6.2.1, MPFR version 4.1.0, MPC version 1.2.1, isl version isl-0.24-GMP Adding extra link options like -lgomp and -lpthread and -static does not he= lp, nor does using a different omp_sync_hint (and none of these should in fact help). Also confirmed with v11.3.0 and v9.5.0. As a sanity check, the non-hint version works fine: #include int main() { omp_lock_t lock; omp_init_lock(&lock); } These results are consistent with the observation that all of the init...lo= ck versions ({with and without hints} x {with and without nesting}) are declar= ed in omp.h, while only the versions without hints are defined in gcc/libgomp/lock.c omp_init_lock_with_hint() and omp_init_nest_lock_with_hint() are part of the OpenMP 4.5 spec (Nov 2015), which is documented as being fully supported si= nce gcc v6. The expedient solution of course would be to define in gcc/libgomp/lock.c t= he two init...with_hint functions to ignore the hint and call their correspond= ing unhinted init functions, e.g: void omp_init_lock_with_hint(omp_lock_t *lock, omp_sync_hint_t) { omp_init_lock(lock); } void omp_init_nest_lock_with_hint(omp_nest_lock_t *lock, omp_sync_hint_= t) { omp_init_nest_lock(lock); } Combined with the appropriate alias magic in the various gcc/libgomp/config/*/lock.c files. It would be particularly impressive to actually use the hints to make the l= ocks faster, but that's a larger project which probably deserves its own Bugz entry...=