[PATCH][C++] Fix libjava breakage on darwin, PR35035
Jack Howarth
howarth@bromo.msbb.uc.edu
Fri Feb 1 15:06:00 GMT 2008
This patch solves the problem here on powerpc-apple-darwin9
with the expected libjava testsuite results...
Native configuration is powerpc-apple-darwin9
=== libjava tests ===
Running target unix
FAIL: Thread_Sleep_2 output - source compiled test
FAIL: Thread_Sleep_2 -findirect-dispatch output - source compiled test
FAIL: Thread_Sleep_2 -O3 output - source compiled test
FAIL: Thread_Sleep_2 -O3 -findirect-dispatch output - source compiled test
=== libjava Summary ===
# of expected passes 2546
# of unexpected failures 4
Compiler version: gcc libjava
Platform: powerpc-apple-darwin9
configure flags: --prefix=/sw --prefix=/sw/lib/gcc4.3 --mandir=/sw/share/man --infodir=/sw/share/info --enable-languages=c,c++,fortran,objc,java --build=powerpc-apple-darwin9 --with-gmp=/sw --with-libiconv-prefix=/usr --with-system-zlib --x-includes=/usr/X11R6/include --x-libraries=/usr/X11R6/lib --disable-libjava-multilib
On Thu, Jan 31, 2008 at 03:14:49PM +0100, Richard Guenther wrote:
> On Thu, 31 Jan 2008, Richard Guenther wrote:
>
> >
> > The following patch un-breaks the java ABI on darwin by not making
> > jboolean the same as bool, but unconditionally use QImode while still
> > retaining the fix to make jboolean have boolean semantics. To
> > not make changes all over the place in the C++ frontend to support
> > two distinct boolean types we still link both types via their
> > main variant and canonical types and thus only retain the difference
> > during structure layout and at expansion time. Hopefully at least.
>
> Ok, seems that it doesn't. As reported by Andreas, this fails
> building libjava with
>
> /Volumes/development/gcc/head/gcc/libjava/jni.cc:470: internal compiler
> error:
> in emit_move_insn, at expr.c:3379
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <http://gcc.gnu.org/bugs.html> for instructions.
>
> Now, I'm not too eager to revert the original patch as we will
> have jboolean behave in strange ways. We could apply the
> reversion conditional on TYPE_MODE (boolean_type_node) !=
> smallest_mode_for_size (1, MODE_INT), but to make language behavior
> dependent on the target ABI may be even worse(?)
>
> Well, at least I don't really want to debug problems with innocent
> programmers using jboolean... :/
>
> Oh well.
>
> Richard.
>
> 2008-01-31 Richard Guenther <rguenther@suse.de>
>
> PR java/35035
> * decl.c (record_builtin_java_type): Make jboolean a
> integer type again where its mode doesn't match that of bool.
>
> Index: cp/decl.c
> ===================================================================
> *** cp/decl.c (revision 131958)
> --- cp/decl.c (working copy)
> *************** record_builtin_java_type (const char* na
> *** 3161,3167 ****
> type = make_signed_type (size);
> else if (size == -1)
> { /* "__java_boolean". */
> ! type = build_variant_type_copy (boolean_type_node);
> }
> else if (size > -32)
> { /* "__java_char". */
> --- 3161,3173 ----
> type = make_signed_type (size);
> else if (size == -1)
> { /* "__java_boolean". */
> ! if ((TYPE_MODE (boolean_type_node)
> ! == smallest_mode_for_size (1, MODE_INT)))
> ! type = build_variant_type_copy (boolean_type_node);
> ! else
> ! /* ppc-darwin has SImode bool, make jboolean a 1-bit
> ! integer type without boolean semantics there. */
> ! type = make_unsigned_type (1);
> }
> else if (size > -32)
> { /* "__java_char". */
More information about the Gcc-patches
mailing list