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

Prevent GCC 8 from reporting error in ClassLoader::file_name_for_class_name()

    XMLWordPrintable

Details

    • Enhancement
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • 12
    • 12, 13
    • hotspot

    Backports

      Description

        src/hotspot/share/classfile/classLoader.cpp: In static member function ‘static const char* ClassLoader::file_name_for_class_name(const char*, int)’:
        src/hotspot/share/classfile/classLoader.cpp:1233:53: error: argument to ‘sizeof’ in ‘char* strncpy(char*, const char*, size_t)’ call is the same expression as the source; did you mean to use the size of the destination? [-Werror=sizeof-pointer-memaccess]
           strncpy(&file_name[class_name_len], class_suffix, sizeof(class_suffix));
                                                             ^~~~~~~~~~~~~~~~~~~~

        The code itself looks correct and it seems having variable for suffix length should be enough.

        Attachments

          Issue Links

            Activity

              People

                dchuyko Dmitry Chuyko
                dchuyko Dmitry Chuyko
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: