delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/03/15/16:59:03

From: cnc AT netcom DOT com (Christopher Christensen)
Date: Tue, 15 Mar 1994 13:08:18 PST
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: gcc extended asm bug?

It turned out not to be a bug.  When listing clobbered registers in an asm()
statement, no percent-signs ("%") should be used to name the registers.
If percent-signs are used, gcc will not complain but it will ignore the
clobbered register list.  The manual is confusing on this, so I thought this
potential pitfall should be posted to the list.  Thanks to Dieter Buerssner
for this info. 

The corrected example follows:

void foo()
{
asm(
 "movl $0,%%edi
  movl $0,%%esi
  movl $0,%%ebx"
:: "b" (5), "S" (10)
: "ebx", "esi", "edi", "cc");
}


-- 
----------------------------------------------------------------------
:  Christopher  :  Huntington Beach California, USA                  :
:  Christensen  :  email:  cnc AT netcom DOT com                            :
----------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019