When examining the assembler output (compiled with -O2) from this class:
public class T
{
Object f1()
{
Object o = new Object();
return o.getClass();
}
}
We see a check for a null return value from _Jv_AllocObjectNoFinalizer (i.e.
the new operator).
However _Jv_AllocObjectNoFinalizer always returns non-null values. On
out-of-memory it throws an OutOfMemoryError
--
Summary: Redundant null pointer checks generated on refrerences
returned by new operator.
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P2
Component: java
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: daney at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24242