https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127431
Bug ID: 127431
Summary: struct field default = address of label can cause
assembly with reference to undefined local label
Product: gcc
Version: 16.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: alanas.00 at mail dot ru
Target Milestone: ---
1. save this code as a.c++:
```
inline auto f() {
label:
struct address_of_label_container {
void *a = &&label;
};
return address_of_label_container{};
}
decltype(f()) global_variable;
```
2. run g++ -S a.c++
generated a.s:
```
.file "a.c++"
.text
.globl global_variable
.data
.align 8
.type global_variable, @object
.size global_variable, 8
global_variable:
.quad .L1
.ident "GCC: (SUSE Linux) 16.2.0"
.section .note.GNU-stack,"",@progbits
```
.L1 is not defined anywhere but is used to initialize global_variable
clang++ has similar bug:
https://github.com/llvm/llvm-project/issues/219659#issuecomment-5468553973