https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119487
Bug ID: 119487
Summary: Marking inline variable as 'noinit' causes assembly
warning
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: palchak at google dot com
Target Milestone: ---
Marking an inline variable with the 'noinit' attribute causes the assembler to
emit a `Warning: setting incorrect section type` warning.
Reproduction:
Input file:
```
[[gnu::used, gnu::noinit]]
inline int comdat_array[42];
[[gnu::used, gnu::noinit]]
static int internal_array[42];
```
Command line:
`g++ -std=c++17 -c noinit.cc -o noinit.o`
Output:
```
/tmp/cc2oypYv.s: Assembler messages:
/tmp/cc2oypYv.s:4: Warning: setting incorrect section type for
.noinit.comdat_array
```
Full reproduction here:
https://godbolt.org/z/Pv53rE4Y3
The compiler explorer reproduction also shows the assembly listing. From the
listing it can be clearly seen that the `.noinit.comdat_array` section is
emitted with PROGBITS type instead of NOBITS type.