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

Make mlvmJvmtiUtils strncpy uses GCC 10.x friendly

    XMLWordPrintable

Details

    • b13

    Backports

      Description

        gcc 10.2 is producing a warning for mlvmJmvtiUtils.cpp:

        In file included from test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/libIndyRedefineClass.cpp:31:
        test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp:100:12: error: 'char* strncpy(char*, const char*, size_t)' specified bound 256 equals destination size [-Werror=stringop-truncation]
          100 | strncpy(mn->classSig, szSignature, sizeof(mn->classSig));
              | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        cc1plus: all warnings being treated as errors

        It seems like gcc is not smart enough to realize that the strncpy on the previous line (mn->methodName) cannot modify szSignature.

        Attachments

          Issue Links

            Activity

              People

                mikael Mikael Vidstedt
                mikael Mikael Vidstedt
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: