java/3096: GCJ does not increment

Alexandre Petit-Bianco apbianco@cygnus.com
Wed Jul 18 17:26:00 GMT 2001


aneesha@hpl.hp.com writes:

> GCJ does not increment the value of an entry in an array when
> the increment operator "++" is used in front. It, however,
> works when the operator is appended at the end.

The bug manifests itself only when compiling to native, regardless of
-f{no-}bounds-check. The index has to be a non numeric value.

When I put a breakpoint in expand_expr, I see that in the case of `++a[i]'
`(reg:SI 72)' is being returned. When `a[i]++' is presented, then

  (queued:SI (mem:SI (reg:SI 70) 0)
      (nil)
      (nil)
      (parallel[ 
              (set (mem:SI (reg:SI 70) 0)
                  (plus:SI (mem:SI (reg:SI 70) 0)
                      (const_int 1 [0x1])))
              (clobber (reg:CC 17 flags))
          ] )
      (nil))
  
is returned. -S shows that no code is generated for `++a[i].'

./A

class T
{
  public static void main(String [] args) {
    int a[] = new int[1];
    int i = 0;
    ++a[i];
    System.out.println (a[i]);
  }
}



More information about the Gcc-bugs mailing list