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

            Bug ID: 119153
           Summary: [14 Regression] Static storage for initializer_list no
                    longer shares with array literals
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lichray at gmail dot com
  Target Milestone: ---

Consider

    void f(std::initializer_list<int> il);

    template <std::size_t N> void g(int const (&il)[N]);

    void t()
    {
        f({3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5});
        g({3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5});
    }

In GCC 14, after implementing P2752, two redundant copies of rodata are
emitted, one for copying to the stack to call g, and one passed to f.

https://godbolt.org/z/1WGjb6dvq

Reply via email to