From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10002 invoked by alias); 6 May 2010 06:37:05 -0000 Received: (qmail 9955 invoked by uid 48); 6 May 2010 06:36:50 -0000 Date: Thu, 06 May 2010 06:37:00 -0000 Subject: [Bug inline-asm/43998] New: inline assembler: can't set clobbering for input register X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "socketpair at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-05/txt/msg00524.txt.bz2 mmarkk@mmarkk-desktop:~/src/vmdetect$ gcc --version gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1 ---------------------------------------------- #include #include int main (void) { size_t ecx; asm ("cpuid": "=c" (ecx): "a" (0x1):"eax","ebx","edx"); printf ("Suspected %s machine!\n", (ecx >> 31) ? "virtual" : "real"); return 0; } mmarkk@mmarkk-desktop:~/src/vmdetect$ gcc 1main.c 1main.c: In function ‘main’: 1main.c:7: error: can't find a register in class ‘AREG’ while reloading ‘asm’ 1main.c:7: error: ‘asm’ operand has impossible constraints ------------------------------------------------ #include #include int main (void) { size_t ecx, dontneed; asm ("cpuid": "=c" (ecx),"=a"(dontneed): "a" (0x1):"ebx","edx"); printf ("Suspected %s machine!\n", (ecx >> 31) ? "virtual" : "real"); return 0; } works OK. How to correctly say compiler about clobbering eax register ? -- Summary: inline assembler: can't set clobbering for input register Product: gcc Version: 4.4.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: inline-asm AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: socketpair at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43998