* Problems with inline asm
@ 2003-08-29 8:18 Kyle Centers
0 siblings, 0 replies; only message in thread
From: Kyle Centers @ 2003-08-29 8:18 UTC (permalink / raw)
To: gcc-help
Hi,
I'm not sure if I'm doing something stupid or not, but the following code does odd things to g++-3.3.1. If I compile it with -O(or higher), it compiles and runs, no problem. But if I try to compile without optimization, I get "error: inconsistent operand constraints in an `asm'". If I change the two "ra's" in the asm operands to "a's", the program compiles error free at any -O level. I really think this is a bug in g++, but It's also possible I am misunderstanding the rather poor inline asm documentation. In any case, I'd really appreciate someone looking at this before I go insane.
#include <iostream>
using namespace std;
int main(void)
{
int a=1;
int b=2;
int &ra=a;
int &rb=b;
asm(" movl %0, %%eax\n\
add %2, %%eax\n\
movl %%eax, %0\n\
"
:"=m"(ra)
:"0"(ra), "m"(rb)
:"%eax"
);
cout << a << endl;
return 0;
}
Thanks,
Kyle Centers
--
__________________________________________________________
Sign-up for your own personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
CareerBuilder.com has over 400,000 jobs. Be smarter about your job search
http://corp.mail.com/careers
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-08-29 8:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-29 8:18 Problems with inline asm Kyle Centers
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).