`asm' in natObject.cc

Bryce McKinlay bryce@waitaki.otago.ac.nz
Sat Dec 1 21:00:00 GMT 2001


Tom Tromey wrote:

>>>>>>"Tom" == Tom Tromey <tromey@redhat.com> writes:
>>>>>>
>
>Tom> On my x86 box I'm seeing a libgcj build failure:
>Tom> [ ... ]
>Tom>     ../../../gcc/libjava/java/lang/natObject.cc:329: inconsistent operand 
>Tom>        constraints in an `asm'
>
>I can see this again by building natObject.cc with CXXFLAGS=-g.
>Can someone tell me whether this is a g++ bug or a libgcj bug?
>

I'm guessing that its a libgcj bug, but a g++ bug that it doesn't get 
reported at -O2. I'm no "asm" expert, but this fixed it for me:

Index: natObject.cc
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/lang/natObject.cc,v
retrieving revision 1.20
diff -u -r1.20 natObject.cc
--- natObject.cc        2001/10/31 00:48:16     1.20
+++ natObject.cc        2001/12/02 04:52:01
@@ -328,7 +328,8 @@
     char result;
     __asm__ __volatile__("lock; cmpxchgl %2, %0; setz %1"
                : "=m"(*(addr)), "=q"(result)
-               : "r" (new_val), "0"(*(addr)), "a"(old) : "memory");
+               : "r" (new_val), "m"(*(addr)), "a"(old)
+               : "memory");
     return (bool) result;
   }
 
I think it is complaining about "*(addr)" not having the same set of 
constraints each time it is used.

>Also, if the build of natObject.cc fails, then natObject.d is removed,
>causing future `make' invocations to fail.  Bryce, I assume this is a
>bug in your recent Makefile.am changes (I still haven't really looked
>at them).
>

Oops - the behaviour of "-MD -MF" must be slightly different between gcj 
and g++ because gcj doesn't delete the deps file when compilation fails. 
I checked in the patch below which should take care of it.

regards

Bryce.


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libjava-deps.patch
URL: <http://gcc.gnu.org/pipermail/java/attachments/20011201/0b91bd3d/attachment.ksh>


More information about the Java mailing list