Bug 24242 - Redundant null pointer checks generated on refrerences returned by new operator.
Summary: Redundant null pointer checks generated on refrerences returned by new operator.
Status: RESOLVED DUPLICATE of bug 21856
Alias: None
Product: gcc
Classification: Unclassified
Component: java (show other bugs)
Version: 4.1.0
: P2 enhancement
Target Milestone: ---
Assignee: Andrew Pinski
URL:
Keywords: missed-optimization
Depends on: 19476 20318
Blocks:
  Show dependency treegraph
 
Reported: 2005-10-06 17:27 UTC by David Daney
Modified: 2005-11-12 20:09 UTC (History)
5 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2005-10-06 17:35:53


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Daney 2005-10-06 17:27:33 UTC
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
Comment 1 Andrew Pinski 2005-10-06 17:35:53 UTC
Confirmed, just like the example in PR 19476 for the C++ case.
Comment 2 Andrew Pinski 2005-11-12 20:06:18 UTC
Will look into marking _Jv_AllocObjectNoFinalizer with the non zero attribute which is added with PR 20318.
Comment 3 Andrew Pinski 2005-11-12 20:09:05 UTC
This is actually a dup of bug 21856.

*** This bug has been marked as a duplicate of 21856 ***