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

Fix offset_of conversion warnings in runtime code

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Fixed
    • P4
    • 21
    • 21
    • hotspot
    • None
    • b24

    Description

      The definition of offset_of() in globalDefinitions_*.hpp returns a type size_t which in all the uses in header files does an implicit conversion down to an 'int'. The 'int' is large enough to hold offset_of things and there's a function and comment in src/hotspot/share/utilities/sizes.hpp:

          // Use the following #define to get C++ field member offsets
          #define byte_offset_of(klass,field) in_ByteSize((int)offset_of(klass, field))

      Fixing the header file uses of offset_of avoids -Wconversion warnings when also disabling -Werror from 1,621,150 to 863,682 lines of warnings.

      Attachments

        Issue Links

          Activity

            People

              coleenp Coleen Phillimore
              coleenp Coleen Phillimore
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: