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

Disable uninitialized warnings for two files until proper fix available

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 9, 10
    • Fix Version/s: 11
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
      b01

      Description

      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).

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: