From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:42239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdyOC-0007R7-M0 for qemu-devel@nongnu.org; Tue, 05 Jul 2011 01:41:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QdyOA-0007jU-Uo for qemu-devel@nongnu.org; Tue, 05 Jul 2011 01:41:40 -0400 Received: from mail-yi0-f45.google.com ([209.85.218.45]:38796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdyOA-0007jP-Kf for qemu-devel@nongnu.org; Tue, 05 Jul 2011 01:41:38 -0400 Received: by yia25 with SMTP id 25so2635187yia.4 for ; Mon, 04 Jul 2011 22:41:37 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 5 Jul 2011 06:41:36 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Qemu-devel] [PATCH 2/3] Add fno-strict-overflow List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Raghavendra D Prabhu , qemu-devel@nongnu.org, Raghavendra D Prabhu , kvm@vger.kernel.org On Mon, Jul 4, 2011 at 11:38 PM, Peter Maydell wrote: > On 4 July 2011 23:00, Raghavendra D Prabhu wrote: >> This is to avoid gcc optimizating out the comparison in assert, >> due to assumption of signed overflow being undefined by default (-Werror=strict-overflow). > >>--- a/Makefile.hw >>+++ b/Makefile.hw >>@@ -9,7 +9,7 @@ include $(SRC_PATH)/rules.mak >> >> $(call set-vpath, $(SRC_PATH):$(SRC_PATH)/hw) >> >> -QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu >> +QEMU_CFLAGS+=-I.. -I$(SRC_PATH)/fpu -fno-strict-overflow > > Can you give a more detailed description of the problem this is trying > to solve? I think it would be nicer if we could remove the assumptions > about signed overflows instead, if that's practical. > > (Also, if we do want to add this compiler flag then it ought to be > done in configure I think, as we do for -fno-strict-aliasing.) "a correct C/C++ program must never generate signed overflow when computing an expression. It also means that a compiler may assume that a program will never generated signed overflow." http://www.airs.com/blog/archives/120 Stefan