On Sun, 2022-12-18 at 00:52 +0800, Yonggang Luo via Elfutils-devel
wrote:
> This block of code can not be removed. As it's contains a goto label
> enomem that been used elsewhere

aha, that certainly explains why gcc gets confused about whether those
variables are used. It is slightly ugly code :{

But added a ChangeLog entry and pushed as attached.

Thanks,

Mark
From 1984819d6ee2dc56583d3f11b9f6e3b2f491f62e Mon Sep 17 00:00:00 2001
From: Yonggang Luo <luoyongg...@gmail.com>
Date: Sun, 18 Dec 2022 00:52:03 +0800
Subject: [PATCH] libcpu: Use __asm instead of asm to mark variables as used

This block of code can not be removed. As it's contains a goto label
enomem that been used elsewhere.

Signed-off-by: Yonggang Luo <luoyongg...@gmail.com>
---
 libcpu/ChangeLog     | 4 ++++
 libcpu/i386_disasm.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/libcpu/ChangeLog b/libcpu/ChangeLog
index bd517b94..6d4b717a 100644
--- a/libcpu/ChangeLog
+++ b/libcpu/ChangeLog
@@ -1,3 +1,7 @@
+2022-12-18  Yonggang Luo  <luoyongg...@gmail.com>
+
+	* i386_disasm.c (i386_disasm): Use __asm instead of asm.
+
 2022-12-20  Mark Wielaard  <m...@klomp.org>
 
 	* bpf_disasm.c: Include common.h and libeblP.h.
diff --git a/libcpu/i386_disasm.c b/libcpu/i386_disasm.c
index c42f8d1c..09946273 100644
--- a/libcpu/i386_disasm.c
+++ b/libcpu/i386_disasm.c
@@ -480,8 +480,8 @@ i386_disasm (Ebl *ebl __attribute__((unused)),
 
 	      /* gcc is not clever enough to see the following variables
 		 are not used uninitialized.  */
-	      asm (""
-		   : "=mr" (opoff), "=mr" (correct_prefix), "=mr" (codep),
+	      __asm (""
+		     : "=mr" (opoff), "=mr" (correct_prefix), "=mr" (codep),
 		     "=mr" (next_curr), "=mr" (len));
 	    }
 
-- 
2.18.4

Reply via email to