This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PR c++/33887] Fix incorrect use of jboolean in link.cc


On Jan 18, 2008 9:19 PM, Richard Guenther <richard.guenther@gmail.com> wrote:
> 2008/1/18 Alexandre Oliva <aoliva@redhat.com>:
>
> > We've been lucky for a while, because C++ doesn't reduce types
> > narrower than registers to their native width after every operation,
> > or ever.  This enabled jboolean to behave like an unsigned byte,
> > rather than like a single bit, in the use in link.cc.
> >
> > As we experimented transitioning C++ to a reduce-after-every-operation
> > mode, as a possible fix for PR c++/33887, this thinko in libjava got
> > exposed, because, with the change, the jboolean gets truncated to a
> > single bit.  So, when a superclass has an even number of interfaces,
> > it remains unchanged, and when two superclasses both have odd numbers
> > of interfaces, they cancel out.  Oops.
> >
> > Fixed with the patch below, that Tom Tromey pre-approved.  I'll check
> > it in as soon as my re-testing is completed.
>
> Jikes!  Thanks for tracking this down!

Thinking about it -- jboolean is unsigned : 1?  I guess for b += x to work it
should be bool : 1, which has special semantics for addition.  That is:

static tree
record_builtin_java_type (const char* name, int size)
{
  tree type, decl;
  if (size > 0)
    type = make_signed_type (size);
  else if (size > -32)
    { /* "__java_char" or ""__java_boolean".  */
      type = make_unsigned_type (-size);
      /*if (size == -1) TREE_SET_CODE (type, BOOLEAN_TYPE);*/
    }

uncomment the line?

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]