This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/66192] New: C++ static initializer unnecessary __cxa_guard_acquire for TARGET_RELAXED_ORDERING
- From: "dje at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 18 May 2015 14:28:16 +0000
- Subject: [Bug c++/66192] New: C++ static initializer unnecessary __cxa_guard_acquire for TARGET_RELAXED_ORDERING
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66192
Bug ID: 66192
Summary: C++ static initializer unnecessary __cxa_guard_acquire
for TARGET_RELAXED_ORDERING
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dje at gcc dot gnu.org
Target Milestone: ---
// static_init.cc
int* f(void) {
static int* p = new int;
return p;
}
$ g++ -O2 -S -fno-exceptions static_init.cc
generates an unnecessary call to __cxa_guard_acquire on what should be the fast
path for targets with TARGET_RELAXED_ORDERING defined. The guard should be an
atomic variable accessed with the equivalent of __atomic_load(ACQUIRE) instead
of a heavy-weight __cxa_guard_acquire() call invoking heavier-weight
synchronization.