qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] cpu-exec: Fix compiler warning (-Werror=clobber


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] cpu-exec: Fix compiler warning (-Werror=clobbered)
Date: Wed, 18 Sep 2013 16:26:02 +0900

On 18 September 2013 08:06, Jan Kiszka <address@hidden> wrote:
> On 2013-09-17 23:24, Peter Maydell wrote:
>> On 17 September 2013 18:03, Stefan Weil <address@hidden> wrote:
>>> could you please review this patch which removes code added by you earlier?
>>> I have run tests with the old code and assertions to see whether the values
>>> were really smashed. They never were, and from the documentation of setjmp
>>> I'd not expect that they ever might be.
>>
>> We had a discussion about this back in 2011. Any compiler which needs
>> these statements is definitely buggy -- the C standard mandates that
>> they're not needed.
>
> I'm not that sure about this. We have a no-return function involved
> between setjmp and the actual longjmp. Why should the compiler have to
> preserve local variables when entering cpu_loop_exit?

Because the C standard specification for setjmp and longjmp
says it must (if they are not changed between the setjmp and
the longjmp call; locals which are changed need not be preserved).
I quoted the relevant section from C99 in the discussion I linked.
And gcc's documentation of the 'noreturn' attribute specifically
says it does not affect the exceptional path where the function
returns via longjmp.

-- PMM



reply via email to

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