This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][C++] Make __java_boolean a true bool (PR 33887)
On Wed, 30 Jan 2008, Andrew Haley wrote:
> Richard Guenther wrote:
> > > Just make jboolean a byte type on Darwin. The only place it might matter
> > > is when someone (say) increments a jboolean and expects it to have
> > > semantics
> > > different from a byte, and that isn't massively important. We never said
> > > jboolean would have the exact same semantics as bool anyway.
> >
> > Well, then we can just revert this patch entirely. But I'm curious if
> > things that used to work before (like the single libjava occurance we
> > fixed) start to fail now.
> >
> > But, probably better than breaking the ABI on darwin anyway.
> >
> > So, if nobody objects I'm going to revert this patch tomorrow.
>
> I think so. I'm not sure I understand how all this happened.
>
> There was a bug involving bitfield references in C++, and fixing
> this bug somehow caused jboolean no longer to be treated as a
> 1-bit boolean type. Aoliva fixed the "+=" in libjava, and this was
> enough to fix the regressions.
In fact, jboolean is now treated as a 1-bit integer type with its
precision more rigorously enforced (read: truncated) than before.
(Before the C++ fixes truncation only happened at the point you
store a register to memory, but not for intermediate operations
in registers)
> Then you tried to make __java_boolean a true bool, in order to
> preserve its special semantics on increment. But this broke Darwin,
> where C++ bool is 4 bytes wide. So, was __java_boolean a true bool
> before the change that fixed the bug involving bitfield references
> in C++ ?
Not really, but most of the time you didn't notice, with the C++ fix
you will now for sure notice that it isn't a boolean.
> So, if you revert this patch, there will be no ABI change, but there
> will be a minor change in the semantics of __java_boolean, which will
> become an integer type.
With the patch reverted all is back to before for jboolean, just that
we no longer generate 'wrong' code but enforce its 1-bit integer
semantics correctly ;) (which might be indeed confusing to users - at
least I expected that jboolean behaves like bool as far as semantics
are concerned)
Richard.