[lld] [lld][NFC] Silence -Wuninitialized GCC warnings. (PR #75183)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 12 05:35:19 PST 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-platform-windows
@llvm/pr-subscribers-lld-coff
Author: Jacek Caban (cjacek)
<details>
<summary>Changes</summary>
A workaround for warnings reported in #<!-- -->69101. Use of those variables is guarded by lastType, so I don't think that they are actually used uninitialized and I don't see the warning on GCC 12.3.
---
Full diff: https://github.com/llvm/llvm-project/pull/75183.diff
1 Files Affected:
- (modified) lld/COFF/Writer.cpp (+1-1)
``````````diff
diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp
index 7b1ff8071e2e3..89e0f5b2df744 100644
--- a/lld/COFF/Writer.cpp
+++ b/lld/COFF/Writer.cpp
@@ -560,7 +560,7 @@ void Writer::createECCodeMap() {
codeMap.clear();
std::optional<chpe_range_type> lastType;
- Chunk *first, *last;
+ Chunk *first = nullptr, *last = nullptr;
auto closeRange = [&]() {
if (lastType) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/75183
More information about the llvm-commits
mailing list