[PATCH 0/3] Misc fixups for --enable-gather-detailed-mem-stats

Lewis Hyatt <[email protected]> Sat, 1 Aug 2026 10:02:40 -0400
Newsgroups gmane.comp.gcc.patches
Message-ID <[email protected]>
Hello-

While testing some recent LTO patches, I tried to configure with
--enable-gather-detailed-mem-stats and ran into a few issues, which are
fixed by this patch series:

Patch 1/3:
Most PCH tests fail. This was previously reported as PR28734 and it just
needs a simple one-line fix.

Patch 2/3:
After the first fix, there are still a couple hundred failing tests. Also,
bootstrap fails in stage 2 when using BUILD_CONFIG=bootstrap-lto. The
statistics gathering infrastructure does not support tracked objects (vec,
hash_map, etc) that are statically allocated, but such objects are used in
many places. My suggested fix arranges that the statistics gathering objects
are never destroyed, obviating any static destruction ordering issues. I
think it is fine to remove their destructors, since they persist for the
entire duration of the process anyway. Otherwise it could be done to
maintain some flag to indicate when the objects have been destroyed and
should no longer be used, but it would be more error-prone.

Patch 3/3:
After the other patches, the testsuite results are identical with and
without --enable-gather-detailed-mem-stats, for both plain bootstrap and
bootstrap-lto, except for one JIT test (test-threads.c) that I think just
needs to be skipped.

Tested all languages except for rust on x86-64 and on aarch64-linux-gnu
(cfarm425). rust does not build with --enable-gather-detailed-mem-stats,
which is PR108631 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108631.
There is a patch there from Martin which will still apply with some minor
rebasing. It looks like it was maybe waiting on feedback from rust
maintainers? Thanks!

-Lewis

---

  statistics: Fix --enable-gather-detailed-mem-stats for PCH [PR28734]
  statistics: Fix destruction ordering issues with mem_alloc_description
  jit: testsuite: Skip test-threads.c with --enable-gather-detailed-mem-stats