On Mon Aug 12, 2024 at 1:05 PM CEST, Faidon Liambotis wrote:
> On Sun, Aug 11, 2024 at 12:31:21PM -0400, Reinhard Tartler wrote:
> > But you are right, ultimately this decision is up to the maintainer to make.
>
> Maintainer here :)
>
> For this particular case, I think removing -Werror made sense as a quick
> fix to avoid kicking out the entire WasmEdge -> crun -> podman stack out

I wondered why wasmedge ended up on my radar, but that explains it ;-)

> of testing, for what is a bug that existed before (i.e. not a
> regression), and was just surfaced by a new compiler version. I had
> looked into the bug before Reinhard NMUed and the fix wasn't obvious to
> me. So taking a shortcut and prioritizing expediency over correctness
> made sense to me, in this particular case.

Yeah, makes a lot of sense.

> But, at the same time, I agree that addressing this properly means
> reporting this upstream so that the underlying bug gets fixed. I see
> this has happened now, and upstream is already responsive (as they
> usually are!).

And what happened is why I like FLOSS so much:
a bunch of people working together to solve a problem :-D

As you may have seen I was able to verify that the proposed fix indeed
solved the GCC-14 compiler issue, so I've DEP-3-ified that patch and
attached it here.

HTH,
  Diederik
From: hydai <hy...@secondstate.io>
Date: Thu, 15 Aug 2024 13:59:51 +0800
Subject: [Loader] Fix GCC 14 maybe-uninitialized warning (#3659)
Origin: upstream, https://github.com/WasmEdge/WasmEdge/commit/e427a71c5a50982c35e124340fc4febcd7600226

Fix #3640

Signed-off-by: hydai <hy...@secondstate.io>
---
 lib/loader/filemgr.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/loader/filemgr.cpp b/lib/loader/filemgr.cpp
index 14afba28..a6e2b95e 100644
--- a/lib/loader/filemgr.cpp
+++ b/lib/loader/filemgr.cpp
@@ -49,6 +49,11 @@ Expect<void> FileMgr::setCode(Span<const Byte> CodeData) {
 // Set code data. See "include/loader/filemgr.h".
 Expect<void> FileMgr::setCode(std::vector<Byte> CodeData) {
   reset();
+  // Tell GCC 14 that DataHolder has no data.
+  // Fix the false positive warning,
+  // which is reported by GCC 14 with `maybe-uninitialized`
+  assuming(!DataHolder);
+
   DataHolder.emplace(std::move(CodeData));
   Data = DataHolder->data();
   Size = DataHolder->size();
-- 
2.45.2

Attachment: signature.asc
Description: PGP signature

Reply via email to