Skip to content

Commit 633375a

Browse files
[llvm][DWARFLinker] Fix gcc 13 -Wuninitialized warnings (#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. llvm-project/llvm/lib/DWARFLinker/Parallel/OutputSections.h:157:67: warning: member ‘llvm::dwarf_linker::parallel::SectionDescriptor::Contents’ is used uninitialized [-Wuninitialized] Which refers to the use in the constructor: ``` SectionDescriptor(DebugSectionKind SectionKind, LinkingGlobalData &GlobalData, dwarf::FormParams Format, llvm::endianness Endianess) : SectionDescriptorBase(SectionKind, Format, Endianess), OS(Contents), ``` Where Contents is passed to `OS`, before Contents has been constructed.
1 parent 3550662 commit 633375a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

llvm/lib/DWARFLinker/Parallel/OutputSections.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ struct SectionDescriptor : SectionDescriptorBase {
181181
/// to the debug section, corresponding to this object.
182182
uint64_t StartOffset = 0;
183183

184+
protected:
185+
/// Section data bits.
186+
OutSectionDataTy Contents;
187+
188+
public:
184189
/// Stream which stores data to the Contents.
185190
raw_svector_ostream OS;
186191

@@ -287,9 +292,6 @@ struct SectionDescriptor : SectionDescriptorBase {
287292

288293
LinkingGlobalData &GlobalData;
289294

290-
/// Section data bits.
291-
OutSectionDataTy Contents;
292-
293295
/// Some sections are generated using AsmPrinter. The real section data
294296
/// located inside elf file in that case. Following fields points to the
295297
/// real section content inside elf file.

0 commit comments

Comments
 (0)