From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:45803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPrje-0001GI-W4 for qemu-devel@nongnu.org; Wed, 10 Apr 2013 05:54:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UPrjd-00077Y-GT for qemu-devel@nongnu.org; Wed, 10 Apr 2013 05:54:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UPrjd-00077R-7I for qemu-devel@nongnu.org; Wed, 10 Apr 2013 05:54:33 -0400 Message-ID: <516536BE.9060104@redhat.com> Date: Wed, 10 Apr 2013 11:54:06 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1365564652-26981-1-git-send-email-lig.fnst@cn.fujitsu.com> <51651853.6090701@redhat.com> <1365580536.9553.97.camel@liguang.fnst.cn.fujitsu.com> In-Reply-To: <1365580536.9553.97.camel@liguang.fnst.cn.fujitsu.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] translate: cleanup gen_intermediate_code_internal List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: li guang Cc: peter.maydell@linaro.org, proljc@gmail.com, e.voevodin@samsung.com, qemu-devel@nongnu.org, blauwirbel@gmail.com, paul@codesourcery.com, afaerber@suse.de, aurelien@aurel32.net, rth@twiddle.net Il 10/04/2013 09:55, li guang ha scritto: > =E5=9C=A8 2013-04-10=E4=B8=89=E7=9A=84 09:44 +0200=EF=BC=8CPaolo Bonzin= i=E5=86=99=E9=81=93=EF=BC=9A >> Il 10/04/2013 05:30, liguang ha scritto: >>> Signed-off-by: liguang >>> --- >>> target-arm/translate.c | 17 ++++++++--------- >>> target-i386/translate.c | 17 ++++++++--------- >>> target-mips/translate.c | 16 ++++++++-------- >>> 3 files changed, 24 insertions(+), 26 deletions(-) >>> >>> diff --git a/target-arm/translate.c b/target-arm/translate.c >>> index 35a21be..c0c080d 100644 >>> --- a/target-arm/translate.c >>> +++ b/target-arm/translate.c >>> @@ -9806,11 +9806,10 @@ static inline void gen_intermediate_code_inte= rnal(CPUARMState *env, >>> cpu_M0 =3D tcg_temp_new_i64(); >>> next_page_start =3D (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_= SIZE; >>> lj =3D -1; >>> - num_insns =3D 0; >> >> Nack. Did you even try to read what I and Wei-Ren Chen were trying to >> tell you? >> >=20 > well, you ask if I tested, and I answer yes, > you doubt if this line really could be removed, > and I said compiler will not complain this. I don't care if the compiler doesn't complain (though I doubt it doesn't; are you using --enable-debug?). It is wrong. You are removing the initialization of num_insns. The only instruction that modifies it is now "num_insns++". That is wrong, period. Even if GCC ends up producing code that works, what happens when you access uninitialized memory is undefined. > what should I do? > Isn't it enough? > did you read my answer for your comment? You didn't reply to this message from Wei-Ren Chen: >> I think 'max_insns =3D tb->cflags & CF_COUNT_MASK;' is enough >> to feed compiler. >=20 > num_insns and max_insns are two different variables, right? So this > assignment does not do anything with num_insns. So yes, I read your answers and no, they were not enough. Paolo