From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1565 invoked by alias); 18 Aug 2008 08:52:23 -0000 Received: (qmail 1551 invoked by uid 22791); 18 Aug 2008 08:52:22 -0000 X-Spam-Check-By: sourceware.org Received: from ugmailsa.ugent.be (HELO ugmailsa.ugent.be) (157.193.49.116) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 18 Aug 2008 08:51:40 +0000 Received: from localhost (localhost [127.0.0.1]) by ugmailsa.ugent.be (Postfix) with ESMTP id 0A266307158 for ; Mon, 18 Aug 2008 10:51:37 +0200 (CEST) Received: from ugmailsa.ugent.be ([127.0.0.1]) by localhost (ugmailsa.ugent.be [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yHuhMGh0LT5m for ; Mon, 18 Aug 2008 10:51:37 +0200 (CEST) Received: from cypress.ugent.be (cypress.ugent.be [157.193.71.48]) by ugmailsa.ugent.be (Postfix) with ESMTP id 442C2307155 for ; Mon, 18 Aug 2008 10:51:37 +0200 (CEST) Received: from cage.ugent.be ([157.193.53.8]) by cypress.ugent.be with ESMTP; 18 Aug 2008 10:51:37 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAJXUqEidwTUI/2dsb2JhbAC0FIFY Received: from [127.0.0.1] (cage [157.193.53.8]) by cage.ugent.be (Postfix) with ESMTP id BE0C23F2A for ; Mon, 18 Aug 2008 10:51:36 +0200 (CEST) Message-ID: <48A937FE.30100@cage.ugent.be> Date: Mon, 18 Aug 2008 10:34:00 -0000 From: Jeroen Demeyer User-Agent: Thunderbird 2.0.0.16 (X11/20080728) MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: Inline assembly constraints question Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2008-08/txt/msg00158.txt.bz2 Hello, I have a C++ program (i386 target) which has a piece of inline assembly with the following constraints: asm(/* Some asm code */ : "=&rm" (n0), "=&r" (n1), "=&r" (n2) : "2" (n0), "1" (n1), "g" (n2), "cI" (s) ); When compiled with g++ 4.1.2 (CXXFLAGS=-O2 -march=pentium4) the operands %0 and %5 get the same memory address, even though they refer to distinct variables (n0 and n2). So, is this a bug in g++ 4.1.2 or am I doing something wrong? g++ 3.4.6 and g++ 4.3.1 generate correct code, but that does not really prove anything. In particular I would like to know: 1) Is it allowed to put matching (digit) constraints referring to different variables? This is what I do with %2. The same register is used as input for variable n0 and as output for variable n2. 2) Is there a way to specify some kind of 'earlyclobber' (&) modifier with a memory constraint? How can I prevent gcc from putting an input variable and an unrelated output variable in the same memory location? Thank you for your time, Jeroen Demeyer.