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

Uninitialized warning in check_code.c with GCC 11.2

XMLWordPrintable

    • b15
    • linux

        src/java.base/share/native/libverify/check_code.c: In function 'read_all_code':
        src/java.base/share/native/libverify/check_code.c:942:5: error: 'lengths' may be used uninitialized [-Werror=maybe-uninitialized]
          942 | check_and_push(context, lengths, VM_MALLOC_BLK);
              | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        src/java.base/share/native/libverify/check_code.c:4145:13: note: by argument 2 of type 'const void *' to 'check_and_push' declared here
         4145 | static void check_and_push(context_type *context, const void *ptr, int kind)
              | ^~~~~~~~~~~~~~


        Because the second argument of check_and_push is "const void*" GCC assumes that the malloc:ed data, which has not yet been initialized, will not be/can not be modified later which in turn suggests it may be used without ever being initialized.

        The same general issue was addressed in JDK-8266168, presumably for GCC 11.1.

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

                Created:
                Updated:
                Resolved: