This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/83730] New: Unnecessary generation of guard variables with -fno-threadsafe-statics
- From: "klaus.doldinger64 at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 07 Jan 2018 20:15:40 +0000
- Subject: [Bug c++/83730] New: Unnecessary generation of guard variables with -fno-threadsafe-statics
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83730
Bug ID: 83730
Summary: Unnecessary generation of guard variables with
-fno-threadsafe-statics
Product: gcc
Version: 7.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: klaus.doldinger64 at googlemail dot com
Target Milestone: ---
Compiling the following example using -fno-threadsafe-statics and -Os still
generates the guard-variables for the member mTop. This is unnecessary and
occupies 8 Bytes on an avr target.
struct A {
A() = default; // if commented out, no guards are allocated
void foo() {}
};
template<typename T>
struct B {
static void foo() {
mTop.foo();
}
inline static T mTop;
};
int main() {
B<A>::foo();
}