strange compiling problem

Jim Wilson wilson@tuliptree.org
Sun Sep 7 01:39:00 GMT 2003


Kyle Centers wrote:
> 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'". 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, could someone please look at this and tell me what's going on, and how to fix it, before I go insane?

inline asm is a hook that lets you scribble on gcc internals.  The only 
way to fully understand it is to fully understand gcc internals.  The 
current doc is a compromise to give you just enough info, but there is 
no way it can handle every case.  If you don't want to learn more about 
gcc internals, avoid inline asm.

It fails because you are using references with memory constraints, but a 
  reference is not necessarily a memory address.  The current 
implementation of references does not handle this case correctly.  If 
you use pointers instead of references, it will work.  If you really 
think references should work, try submitting a C++ bug report and let a 
C++ person think about the design and implementation details.  I suspect 
it probably should work,  but I am not a C++ expert.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list