public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/43998]  New: inline assembler: can't set clobbering for input register
@ 2010-05-06  6:37 socketpair at gmail dot com
  2010-05-06  7:11 ` [Bug inline-asm/43998] " ubizjak at gmail dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: socketpair at gmail dot com @ 2010-05-06  6:37 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1362 bytes --]

mmarkk@mmarkk-desktop:~/src/vmdetect$ gcc --version
gcc (Ubuntu 4.4.1-4ubuntu9) 4.4.1
----------------------------------------------
#include <sys/types.h> 
#include <stdio.h> 
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 <sys/types.h> 
#include <stdio.h> 
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


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-05-14  7:11 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-06  6:37 [Bug inline-asm/43998] New: inline assembler: can't set clobbering for input register socketpair at gmail dot com
2010-05-06  7:11 ` [Bug inline-asm/43998] " ubizjak at gmail dot com
2010-05-06  8:07 ` jakub at gcc dot gnu dot org
2010-05-06 11:00 ` socketpair at gmail dot com
2010-05-06 11:31 ` rguenth at gcc dot gnu dot org
2010-05-06 11:41 ` socketpair at gmail dot com
2010-05-06 13:09 ` hjl dot tools at gmail dot com
2010-05-06 13:42 ` socketpair at gmail dot com
2010-05-06 13:56 ` rguenth at gcc dot gnu dot org
2010-05-06 15:04 ` socketpair at gmail dot com
2010-05-14  2:45 ` pinskia at gcc dot gnu dot org
2010-05-14  6:31 ` socketpair at gmail dot com
2010-05-14  7:11 ` ebotcazou at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).