[llvm] [llvm][DWARFLinker] Fix gcc 13 -Wuninitialized warnings (PR #143867)

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 02:58:02 PDT 2025


https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/143867

A bit awkward that we have to switch from public to protected and back again, but it seemed neater than putting OS all the way down at the bottom. Since it is a public member that you're more likely to be looking for.

>From c0f136fad500a36f57e1b2fa6a3571fc87c5a210 Mon Sep 17 00:00:00 2001
From: David Spickett <david.spickett at linaro.org>
Date: Thu, 12 Jun 2025 09:53:33 +0000
Subject: [PATCH] [llvm][DWARFLinker] Fix gcc 13 -Wuninitialized warnings

A bit awkward that we have to switch from public to protected
and back again, but it seemed neater than putting OS all the way
down at the bottom. Since it is a public member that you're more
likely to be looking for.
---
 llvm/lib/DWARFLinker/Parallel/OutputSections.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/DWARFLinker/Parallel/OutputSections.h b/llvm/lib/DWARFLinker/Parallel/OutputSections.h
index da47f53b6c3d1..5043e918013e4 100644
--- a/llvm/lib/DWARFLinker/Parallel/OutputSections.h
+++ b/llvm/lib/DWARFLinker/Parallel/OutputSections.h
@@ -181,6 +181,11 @@ struct SectionDescriptor : SectionDescriptorBase {
   /// to the debug section, corresponding to this object.
   uint64_t StartOffset = 0;
 
+protected:
+  /// Section data bits.
+  OutSectionDataTy Contents;
+
+public:
   /// Stream which stores data to the Contents.
   raw_svector_ostream OS;
 
@@ -287,9 +292,6 @@ struct SectionDescriptor : SectionDescriptorBase {
 
   LinkingGlobalData &GlobalData;
 
-  /// Section data bits.
-  OutSectionDataTy Contents;
-
   /// Some sections are generated using AsmPrinter. The real section data
   /// located inside elf file in that case. Following fields points to the
   /// real section content inside elf file.



More information about the llvm-commits mailing list