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

Disable uninitialized warnings for two files until proper fix available

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 11
    • 9, 10
    • hotspot
    • b01

      With gcc 7.1.1 from Fedora 26 on x86-64 there are warnings about the potential usage of maybe uninitialized memory in src/hotspot/cpu/x86/assembler_x86.cpp and in src/hotspot/cpu/x86/interp_masm_x86.cpp.

      The problems arises from the class RelocationHolder which has the private fields:
        enum { _relocbuf_size = 5 };
        void* _relocbuf[ _relocbuf_size ];

      and the default constructor for RelocationHolder does not set the elements to _relocbuf to NULL. This is an optimization, RelocationHolder is used *a lot* and setting the elements of RelocationHolder::_relocbuf to NULL in the default constructor might result in a performance penalty. Instead, all users of RelocationHolder::_relocbuf take care to not use uninitialized memory.

      The problem continues because the class Address in src/hotspot/cpu/x86/assembler_x86.hpp has a private field:
        RelocationHolder _rspec;
      and the default constructor for Address does not initialize _rspec._relocbuf (most likely for performance reasons). The class Address also has a default copy constructor, which will copy all the elements of _rspec._relocbuf, which will result in a read of uninitialized memory. However, this is a benign usage of uninitialized memory, since we take no action based on the content of the uninitialized memory (it is just copied byte for byte).

            erikj Erik Joelsson
            ehelin Erik Helin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: