From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33646) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWlli-0004Rw-6W for qemu-devel@nongnu.org; Thu, 17 Oct 2013 07:29:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VWlla-000391-6Y for qemu-devel@nongnu.org; Thu, 17 Oct 2013 07:29:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:19069) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VWllZ-00038x-Tr for qemu-devel@nongnu.org; Thu, 17 Oct 2013 07:29:22 -0400 Date: Thu, 17 Oct 2013 14:31:56 +0300 From: "Michael S. Tsirkin" Message-ID: <20131017113156.GC18678@redhat.com> References: <20131016194653.GA10517@redhat.com> <20131017062751.GK15657@redhat.com> <525FC214.4020501@redhat.com> <20131017105807.GA26798@redhat.com> <525FC3B9.5060807@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <525FC3B9.5060807@redhat.com> Subject: Re: [Qemu-devel] [PATCH] kvm-unittest: fix build with gcc 4.3.X and older List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kvm@vger.kernel.org, Gleb Natapov , qemu-devel@nongnu.org On Thu, Oct 17, 2013 at 01:02:17PM +0200, Paolo Bonzini wrote: > Il 17/10/2013 12:58, Gleb Natapov ha scritto: > >>> > > @@ -143,14 +143,14 @@ static inline int rtc_in(u8 reg) > >>> > > { > >>> > > u8 x = reg; > >>> > > asm volatile("outb %b1, $0x70; inb $0x71, %b0" > >>> > > - : "+a"(x) : "0"(x)); > >>> > > + : "=a"(x) : "0"(x)); > >>> > > return x; > >>> > > } > >> > > >> > This should be wrong. GCC should complain that the same operand is used > >> > for both input and output but has an "=" constraint. > >> > > >>> > > static inline void rtc_out(u8 reg, u8 val) > >>> > > { > >>> > > asm volatile("outb %b1, $0x70; mov %b2, %b1; outb %b1, $0x71" > >>> > > - : "+a"(reg) : "0"(reg), "ri"(val)); > >>> > > + : "=a"(reg) : "0"(reg), "ri"(val)); > >>> > > } > >> > > >> > Same here. > >> > > >> > But I'm not sure what is the error message for older GCC for s3.c, as I > >> > wrote in reply to Michael. > >> > > > x86/s3.c: In function 'main': > > x86/s3.c:145: error: inconsistent operand constraints in an 'asm' > > > > And I am puzzled by this too. > > Hmm, looks like my version is the incorrect one and, if you use "+a" you > need not use the matching input constraint. So it's either your > version, or one that removes the "0" altogether. > > Thus, > > Reviewed-by: Paolo Bonzini Yea, you can add Reviewed-by: Michael S. Tsirkin too. But maybe we can add %k constraints like Paolo said? Being extra careful ... > Paolo