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

HotSpot compile warnings from GCC 9

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b21
    • OS:
      linux

      Backports

        Description

        I saw following warnings when I compiled HotSpot with GCC 9 on Fedora 30:


        /home/ysuenaga/OpenJDK/jdk/src/hotspot/os/linux/osContainer_linux.cpp: In static member function 'static jlong OSContainer::memory_limit_in_bytes()':
        /home/ysuenaga/OpenJDK/jdk/src/hotspot/os/linux/osContainer_linux.cpp:470:22: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
          470 | char* format = "%s " JULONG_FORMAT;

        /home/ysuenaga/OpenJDK/jdk/src/hotspot/os/linux/osContainer_linux.cpp: In static member function 'static jlong OSContainer::memory_and_swap_limit_in_bytes()':
        /home/ysuenaga/OpenJDK/jdk/src/hotspot/os/linux/osContainer_linux.cpp:493:22: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
          493 | char* format = "%s " JULONG_FORMAT;

        /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/gc/shared/ptrQueue.cpp: In constructor 'BufferNode::Allocator::Allocator(const char*, size_t)':
        /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/gc/shared/ptrQueue.cpp:97:10: warning: 'char* strncpy(char*, const char*, size_t)' specified bound 120 equals destination size [-Wstringop-truncation]
           97 | strncpy(_name, name, sizeof(_name));
              | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

        /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/compiler/disassembler.cpp: In constructor 'decode_env::decode_env(CodeBlob*, outputStream*, CodeStrings, ptrdiff_t)':
        /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/compiler/disassembler.cpp:365:32: warning: 'void* memset(void*, int, size_t)' clearing an object of non-trivial type 'class decode_env'; use assignment instead [-Wclass-memaccess]
          365 | memset(this, 0, sizeof(*this)); // Beware, this zeroes bits of fields.
              | ^
        /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/compiler/disassembler.cpp:153:7: note: 'class decode_env' declared here
          153 | class decode_env {
              | ^~~~~~~~~~

        In file included from /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/runtime/thread.hpp:34,
                         from /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/runtime/safepoint.hpp:30,
                         from /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/gc/shared/collectedHeap.hpp:33,
                         from /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/precompiled/precompiled.hpp:37:
        In constructor 'JvmtiCodeBlobDesc::JvmtiCodeBlobDesc(const char*, address, address)',
            inlined from 'static void CodeBlobCollector::do_blob(CodeBlob*)' at /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp:141:94:
        /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/prims/jvmtiExport.hpp:423:12: warning: 'char* strncpy(char*, const char*, size_t)' specified bound 64 equals destination size [-Wstringop-truncation]
          423 | strncpy(_name, name, sizeof(_name));
              | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        In constructor 'JvmtiCodeBlobDesc::JvmtiCodeBlobDesc(const char*, address, address)',
            inlined from 'void CodeBlobCollector::collect()' at /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/prims/jvmtiCodeBlobEvents.cpp:177:94:
        /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/prims/jvmtiExport.hpp:423:12: warning: 'char* strncpy(char*, const char*, size_t)' specified bound 64 equals destination size [-Wstringop-truncation]
          423 | strncpy(_name, name, sizeof(_name));
              | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

        In file included from /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/runtime/thread.hpp:34,
                         from /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/runtime/safepoint.hpp:30,
                         from /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/gc/shared/collectedHeap.hpp:33,
                         from /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/precompiled/precompiled.hpp:37:
        In constructor 'JvmtiCodeBlobDesc::JvmtiCodeBlobDesc(const char*, address, address)',
            inlined from 'void JvmtiDynamicCodeEventCollector::register_stub(const char*, address, address)' at /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/prims/jvmtiExport.cpp:2825:60:
        /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/prims/jvmtiExport.hpp:423:12: warning: 'char* strncpy(char*, const char*, size_t)' specified bound 64 equals destination size [-Wstringop-truncation]
          423 | strncpy(_name, name, sizeof(_name));
              |

          Attachments

            Issue Links

              Activity

                People

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

                  Dates

                  Created:
                  Updated:
                  Resolved: