Received: from eggs.gnu.org ([2001:4830:134:3::10]:47719) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VLygS-0005Un-BN for qemu-devel@nongnu.org; Tue, 17 Sep 2013 13:03:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VLygR-0006wl-5X for qemu-devel@nongnu.org; Tue, 17 Sep 2013 13:03:28 -0400 From: Stefan Weil Date: Tue, 17 Sep 2013 19:03:22 +0200 Message-Id: <1379437402-30804-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] cpu-exec: Fix compiler warning (-Werror=clobbered) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: qemu-trivial , Stefan Weil , Jan Kiszka , Anthony Liguori 'cpu' and 'env' are not modified after sigsetjmp. Therefore they will still have their last value after longjmp restored the stack context. The code which should "reload" both variables causes a compiler warning: cpu-exec.c:204:15: error: variable =E2=80=98cpu=E2=80=99 might be clobbered by =E2=80=98longjmp=E2=80= =99 or =E2=80=98vfork=E2=80=99 [-Werror=3Dclobbered] cpu-exec.c:202:28: error: argument =E2=80=98env=E2=80=99 might be clobbered by =E2=80=98longjmp=E2=80= =99 or =E2=80=98vfork=E2=80=99 [-Werror=3Dclobbered] Remove this unneeded code. Signed-off-by: Stefan Weil --- Jan, could you please review this patch which removes code added by you earlie= r? I have run tests with the old code and assertions to see whether the valu= es were really smashed. They never were, and from the documentation of setjm= p I'd not expect that they ever might be. The patch is needed to fix a compiler warning with -Wextra. Thanks, Stefan cpu-exec.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index 5a43995..fbfb749 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -676,11 +676,6 @@ int cpu_exec(CPUArchState *env) /* reset soft MMU for next block (it can currently only be set by a memory fault) */ } /* for(;;) */ - } else { - /* Reload env after longjmp - the compiler may have smashed = all - * local variables as longjmp is marked 'noreturn'. */ - cpu =3D current_cpu; - env =3D cpu->env_ptr; } } /* for(;;) */ =20 --=20 1.7.10.4