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

            Bug ID: 128215
           Summary: Incorrect mangling of inactive union elemental
                    subobjects
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

union U { int a[4]; };
constexpr U bar (int n) {
  U u;
  __builtin_start_lifetime (&u.a);
  u.a[0] = 42;
  for (int i = 1; i < n; ++i)
    u.a[i] = 0;
  return u;
}
template <auto V, int N>
int foo () { return N; }
int a = foo <bar (1), 42> ();
int b = foo <bar (3), 43> ();
int main () {}

We mangle both calls as
_Z3fooITnDaXtl1Udi1atlA4_iLi42EEEELi42EEiv
_Z3fooITnDaXtl1Udi1atlA4_iLi42EEEELi43EEiv
so the mangling doesn't differentiate between trailing zeros and inactive
elemental subobjects.
Given that changing the mangling of trailing zeros would be an ABI change, I
think we want instead to mangle inactive elemental subobjects somehow
specially.

Reply via email to