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

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

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 12
    • Fix Version/s: 12, 13
    • Component/s: 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

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

                  Dates

                  • Created:
                    Updated:
                    Resolved: