A buglet

Andrew Haley aph@cambridge.redhat.com
Thu Jun 27 11:28:00 GMT 2002


I've found what I think is an interesting optimization bug.

Try this:

Index: Array_3.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/testsuite/libjava.lang/Array_3.java,v
retrieving revision 1.1
diff -p -2 -c -r1.1 Array_3.java
*** Array_3.java	20 Dec 2001 14:09:03 -0000	1.1
--- Array_3.java	27 Jun 2002 18:24:31 -0000
*************** public class Array_3
*** 20,24 ****
      try
        {
! 	int[] x = (int[])foo();
  	nn = x.length;
        }
--- 20,24 ----
      try
        {
! 	int[] x = (int[])null;
  	nn = x.length;
        }

I get a test failure at -O1.  It looks like the null pointer access is
being removed by the optimizer.  Of course, -fcheck-references fixes
things.

Can someone please try this so I know it's not a problem with my
setup?  This is from the trunk.

Andrew.



More information about the Java mailing list