https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100386

            Bug ID: 100386
           Summary: Not all constant brace-init-lists receive symbols
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jengelh at inai dot de
  Target Milestone: ---

Input:

```
#include <cstdio>
#include <initializer_list>
void f(int x) { printf("%d", x); }
void foo(const std::initializer_list<int> &x) { for (auto y : x) f(y); }
int main()
{
        for (auto x : {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15})
                f(x);
        foo({
        1,2,3,4,5,6,7,8,9,2,1,3,4,5,6,7,8,9,3,2,1,4,5,6,7,8,9,5,4,3,
        1,2,3,4,5,6,7,8,9,2,1,3,4,5,6,7,8,9,3,2,1,4,5,6,7,8,9,5,4,3,
        1,2,3,4,5,6,7,8,9,2,1,3,4,5,6,7,8,9,3,2,1,4,5,6,7,8,9,5,4,3,
        });
}
```

Build and objdump:

```
$ gcc -v -O2 -g x.cpp
Target: x86_64-suse-linux
…
gcc version 10.3.0 (SUSE Linux/Tumbleweed)

$ objdump -d a.out
…
0000000000401040 <main>:
  401040:       53                      push   rbx
  401041:       be 01 00 00 00          mov    esi,0x1
  401046:       bb a0 21 40 00          mov    ebx,0x4021a0
  40104b:       48 81 ec 80 01 00 00    sub    rsp,0x180
  401052:       eb 06                   jmp    40105a <main+0x1a>
  401054:       0f 1f 40 00             nop    DWORD PTR [rax+0x0]
  401058:       8b 33                   mov    esi,DWORD PTR [rbx]
  40105a:       bf 04 20 40 00          mov    edi,0x402004
  40105f:       31 c0                   xor    eax,eax
  401061:       48 83 c3 04             add    rbx,0x4
  401065:       e8 c6 ff ff ff          call   401030 <printf@plt>
  40106a:       48 81 fb dc 21 40 00    cmp    rbx,0x4021dc
  401071:       75 e5                   jne    401058 <main+0x18>
  401073:       48 8d 44 24 10          lea    rax,[rsp+0x10]
  401078:       48 8d 7c 24 10          lea    rdi,[rsp+0x10]
  40107d:       be 20 20 40 00          mov    esi,0x402020
  401082:       b9 2d 00 00 00          mov    ecx,0x2d
  401087:       f3 48 a5                rep movs QWORD PTR es:[rdi],QWORD PTR
ds:[rsi]
…
```

Observed output:

```
$ nm a.out | sort
…
0000000000402000 R _IO_stdin_used
00000000004021a0 r C.0.0
…
```

Expected output:

```
$ nm a.out
…
0000000000402000 R _IO_stdin_used
0000000000402020 r C.something.something
00000000004021a0 r C.0.0
…
```

Reply via email to