This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][C++] Fix libjava breakage on darwin, PR35035
On Thu, 31 Jan 2008, Andrew Haley wrote:
> 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(?)
>
> I'm not madly happy about that idea, but it might be the least worst way
> to keep everything running for 4.3.
Bootstrapped and tested on x86_64-unknown-linux-gnu, ok for mainline?
Thanks,
Richard.
(for reference, patch repeated below)
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". */