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

GCC 10 warnings -Wtype-limits with JFR code

XMLWordPrintable

    • jfr
    • b08

        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.

              ysuenaga Yasumasa Suenaga
              ysuenaga Yasumasa Suenaga
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: