Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8347718

Unexpected NullPointerException in C2 compiled code due to ReduceAllocationMerges

XMLWordPrintable

    • b18
    • 23
    • b08

        The attached test file TestC2Miscompile.java prints:

        $ java TestC2Miscompile.java
        true
        true
        false
        false
        true
        true
        false
        true
        true
        true
        false
        true
        false
        true
        false
        true
        NullPointerException: Cannot invoke "TestC2Miscompile$Class0.Class0_method1()"
        true
        false
        false

        Examination of the code shows that the receiver can never be null here. Goes away with either of -Xint or -XX:TieredStopAtLevel=3, so I think this must be a C2 bug.

        Reproduced today with OracleJDK 25+5, but goes back at least half a year.

              cslucas Cesar Soares
              gbarany Gergö Barany
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated:
                Resolved: