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

GCC 10 warnings -Wtype-limits with JFR code

    XMLWordPrintable

    Details

    • Subcomponent:
      jfr
    • Resolved In Build:
      b08

      Backports

        Description

        I saw some warnings in JFR code when I tried to build OpenJDK with GCC 10.1.1 on Fedora 32:

        ```
        /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/jfr/utilities/jfrHashtable.hpp:86:14: warning: comparison of unsigned expression in '>= 0' is always true [-Wtype-limits]
           86 | assert(h >= 0 && h < _table_size, "Illegal hash value");
              | ~~^~~~
        ```

        ```
        /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/jfr/utilities/jfrDoublyLinkedList.hpp:138:17: warning: comparison of unsigned expression in '>= 0' is always true [-Wtype-limits]
          138 | assert(_count >= 0, "invariant");
        ```

        Both `h` and `_cound` are unsigned type, so we can remove them.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                ysuenaga Yasumasa Suenaga
                Reporter:
                ysuenaga Yasumasa Suenaga
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: