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

            Bug ID: 108632
           Summary: [13 Regression] libstdc++ std/time/hh_mm_ss/1.cc on
                    "packed" platforms
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hp at gcc dot gnu.org
  Target Milestone: ---

With a commit in the series r13-4522-gba1536dac780f3..r13-4532-gda7fb32d403759,
the test std/time/hh_mm_ss/1.cc started to fail for cris-elf, where the ABI
mandates structure layout that virtually corresponds to as if declared with the
attribute packed on other platforms.

In libstdc++.log:
/x/gcc/libstdc++-v3/testsuite/std/time/hh_mm_ss/1.cc: In function 'constexpr
void size()':
/x/gcc/libstdc++-v3/testsuite/std/time/hh_mm_ss/1.cc:107: error: static
assertion failed
/x/gcc/libstdc++-v3/testsuite/std/time/hh_mm_ss/1.cc:107: note: the comparison
reduces to '(12 == 11)'

Undoubtedly the cause is commit r13-4526-g5329e1a8e1480d, which included:
106: +  struct S0 { long long h; char m; char s; bool neg; };
107: +  static_assert(sizeof(hh_mm_ss<seconds>) == sizeof(S0));
108: +  struct S1 { long long h; char m; char s; bool neg; char ss; };
109: +  static_assert(sizeof(hh_mm_ss<duration<int, std::centi>>) ==
sizeof(S1));

The test appears to assert that the footprint of hh_mm_ss<seconds> is minimal,
but for that, S0 misses a trailing empty member for hh_mm_ss<seconds> , which
for most targets is hidden in padding, but which require at least one byte of
storage and thus for such targets you'll have sizeof(hh_mm_ss<seconds>) 8+1+1+1
+1 = 12.

Reply via email to