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

C2 incorrectly removes double negation for double and float

    • b16

      C2 incorrectly folds '0 - (0 - x)' to 'x' for double and float 'x':
      https://github.com/openjdk/jdk/blob/4b463ee70eceb94fdfbffa5c49dd58dcc6a6c890/src/hotspot/share/opto/subnode.cpp#L56-L62

      Attached test demonstrates this:

      java -XX:-TieredCompilation -Xbatch -XX:CompileCommand=quiet -XX:CompileCommand=compileonly,Test::test* Test.java
      Exception in thread "main" java.lang.RuntimeException: Invalid result: -2147483648
      at Test.main(Test.java:37)

            mhassig Manuel Hassig
            thartmann Tobias Hartmann
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: