This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: `asm' in natObject.cc
- From: Bryce McKinlay <bryce at waitaki dot otago dot ac dot nz>
- To: tromey at redhat dot com
- Cc: Java Discuss List <java at gcc dot gnu dot org>
- Date: Sun, 02 Dec 2001 18:01:19 +1300
- Subject: Re: `asm' in natObject.cc
- References: <87itbsxlzj.fsf@creche.redhat.com> <87bshil7kh.fsf@creche.redhat.com>
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.
2001-12-02 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* Makefile.am (nat_files, x_nat_files): Make sure the dependencies
don't get deleted if compilation fails.
* Makefile.in: Rebuilt.
Index: Makefile.am
===================================================================
RCS file: /cvs/gcc/gcc/libjava/Makefile.am,v
retrieving revision 1.184
diff -u -r1.184 Makefile.am
--- Makefile.am 2001/11/30 03:03:59 1.184
+++ Makefile.am 2001/12/02 04:28:21
@@ -216,8 +216,9 @@
## is a bug in automake), and it also won't put the .o files into
## subdirs. FIXME.
$(nat_files) $(x_nat_files): %.lo: %.cc
- @echo '$(LTCXXCOMPILE) -c -o $@ $<'; \
- $(LTCXXCOMPILE) -MD -MT $@ -MF $*.d -c -o $@ $<
+ @echo '$(LTCXXCOMPILE) -MD -MT $@ -MF $(@:.lo=.pp) -c -o $@ $<'; \
+ $(LTCXXCOMPILE) -MD -MT $@ -MF $(@:.lo=.pp) -c -o $@ $<
+ @-mv $(@:.lo=.pp) $(@:.lo=.d)
## FIXME: GNU make.
$(c_files): %.lo: %.c