www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/04/04:39:36

To: djgpp AT delorie DOT com
Date: Fri, 04 Feb 2000 09:18:39 0000
From: "Nimrod Alonzo Abing" <synflood AT eudoramail DOT com>
Message-ID: <EHMPDBMAIKAABAAA@shared1-mail.whowhere.com>
Mime-Version: 1.0
X-Sent-Mail: off
X-Expiredinmiddle: true
X-Mailer: MailCity Service
Subject: Clobbering registers in asm and GCC 2.952
X-Sender-Ip: 208.160.246.197
Organization: QUALCOMM Eudora Web-Mail (http://www.eudoramail.com:80)
Reply-To: djgpp AT delorie DOT com

Hello!

Just wondering, if there is a more down-to-
earth explanation of that register clobbering 
stuff in asm using GCC 2.952. 

Quote Gnu GCC FAQ "Problems with invalid 'asm'
statements" section:

"Previous releases of GCC (for example, GCC 
2.7.2 or EGCS 1.1.2) did not detect as invalid 
a clobber specifier that clobbered an operand. 
Instead, it could spuriously and silently 
generate incorrect code for certain non-obvious 
cases of source code. Even more unfortunately, 
the manual (Using and Porting GCC, section 
Extended Asm, see the bug report entry) did not 
explicitly say that it was invalid to specify 
clobber registers that were destined to overlap 
operands; it could arguably be interpreted that 
it was correct to clobber an input operand to 
mark it as not holding a usable value after the 
asm.

"For the general case, there is no way to tell 
whether a specified clobber is intended to 
overlap with a specific (input) operand or is a 
program error, where the choice of actual 
register for operands failed to avoid the 
clobbered register. Such unavoidable overlap is 
detected by versions GCC 2.95 and newer, and 
flagged as an error rather than accepted.

"Unfortunately, a lot of existing software, for 
example the Linux kernel version 2.0.35 for the 
Intel x86, has constructs where input operands 
are marked as clobbered.

"The manual now describes how to write 
constructs with operands that are modified by 
the construct, but not actually used. To write 
an asm which modifies an input operand but does 
not output anything usable, specify that 
operand as an output operand outputting to an 
unused dummy variable."

My reaction to this reasonably obfuscated
description of the problem and its solution was "Huh?!?" And the examples given were too 
short to demonstrate the principles behind it.

Q: Where can I find a more subtle explanation of
what's going on, aside from the cut-and-dry
explanations from the GCC FAQ?

Help will be greatly appreciated. Thanks...


oOOOo Synflood oOOOo





Join 18 million Eudora users by signing up for a free Eudora Web-Mail account at http://www.eudoramail.com

- Raw text -


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