https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66172
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- You need the variable even without thread safe ones because calling the function twice means it gets initlized only once rather twice. There is no other way around this because the variable only gets initialized if the function is called.