This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug java/24242] New: Redundant null pointer checks generated on refrerences returned by new operator.
- From: "daney at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Oct 2005 17:27:33 -0000
- Subject: [Bug java/24242] New: Redundant null pointer checks generated on refrerences returned by new operator.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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