https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88509
--- Comment #3 from Rafael Avila de Espindola <rafael at espindo dot la> --- (In reply to Jakub Jelinek from comment #2) > I must say I don't understand your suggestion. bar is not a pointer and its > address is non-NULL no matter whether it has been already initialized or not. > What kind of assembly you'd like to see for f? Bar is not a pointer, but a guard variable for bar can be. It is initially null and is set to bar's address once bar is initialized. I think the assembly for f could be: _Z1fv: movq %fs:__guard_for_bar@tpoff, %rax testq %rax, %rax je .L15 ret .L15: pushq %rbx movq %fs:0, %rbx leaq _ZL3bar@tpoff(%rbx), %rdi call _ZN3fooC1Ev leaq _ZL3bar@tpoff(%rbx), %rax movq %rax, %fs:__guard_for_bar@tpoff popq %rbx ret The .L15 label could even be moved to a cold section.