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

Change "8048150: Allow easy configurations for large CDS archives" triggers conversion warning with older GCC

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • None
    • hotspot
    • b31
    • generic
    • linux
    • Not verified

        For GCC versions before 4.3 we still use the "-Wconversion" flag so if we build with such a GCC the code introduced by "8048150: Allow easy configurations for large CDS archives" will trigger the following warnings which are treated as errors:

        /src/hotspot-rt/src/share/vm/memory/metaspaceShared.cpp: In static member function 'static void MetaspaceShared::estimate_regions_size()':
        /src/hotspot-rt/src/share/vm/memory/metaspaceShared.cpp:1124: warning: converting to 'uintx' from 'double'
        /src/hotspot-rt/src/share/vm/memory/metaspaceShared.cpp:1125: warning: converting to 'uintx' from 'double'
        /src/hotspot-rt/src/share/vm/memory/metaspaceShared.cpp:1126: warning: converting to 'uintx' from 'double'
        /src/hotspot-rt/src/share/vm/memory/metaspaceShared.cpp:1127: warning: converting to 'uintx' from 'double'
        /src/hotspot-rt/src/share/vm/memory/metaspaceShared.cpp:1129: warning: converting to 'uintx' from 'double'
        /src/hotspot-rt/src/share/vm/memory/metaspaceShared.cpp:1130: warning: converting to 'uintx' from 'double'
        /src/hotspot-rt/src/share/vm/memory/metaspaceShared.cpp:1131: warning: converting to 'uintx' from 'double'
        /src/hotspot-rt/src/share/vm/memory/metaspaceShared.cpp:1132: warning: converting to 'uintx' from 'double'

        The fix is trivial - just implicitly cast the result of the conversion to uintx:

        diff -r 8ae56f4f758f src/share/vm/memory/metaspaceShared.hpp
        --- a/src/share/vm/memory/metaspaceShared.hpp Tue Aug 26 13:07:57 2014 -0700
        +++ b/src/share/vm/memory/metaspaceShared.hpp Wed Aug 27 16:43:39 2014 +0200
        @@ -41,7 +41,7 @@
         
         #define SET_ESTIMATED_SIZE(type, region) \
           Shared ##region## Size = FLAG_IS_DEFAULT(Shared ##region## Size) ? \
        - (type ## SharedArchiveSize * region ## RegionPercentage) : Shared ## region ## Size
        + (uintx)(type ## SharedArchiveSize * region ## RegionPercentage) : Shared ## region ## Size
         
         class FileMapInfo;
         

              simonis Volker Simonis
              simonis Volker Simonis
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: