qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] tcg: Reload local variables after return from l


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] tcg: Reload local variables after return from longjmp
Date: Thu, 11 Aug 2011 14:16:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:5.0) Gecko/20110707 Thunderbird/5.0

On 08/11/2011 01:30 PM, Peter Maydell wrote:
>  Recent compilers look deep into cpu_exec, find longjmp as a noreturn
>  function and decide to smash some stack variables as they won't be used
>  again. This may lead to env becoming invalid after return from setjmp,
>  causing crashes. Fix it by reloading env from cpu_single_env in that
>  case.
Can you give more details of what compiler/platform this was
a problem for? My reading of the C standard is that the compiler
isn't allowed to trash env across this longjmp, because it's
a variable of automatic scope which isn't modified between the
setjmp and the longjmp...

longjmp can destroy any non-volatile variable (-Wclobbered warns about this).

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]