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

-Wnonnull errors happen with GCC 11.1.1

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b06
    • CPU:
      x86, x86_64
    • OS:
      linux

      Description

      I attempted to build OpenJDK on Fedora 34 with gcc-11.1.1-3.fc34.x86_64, but I saw following errors:

      ```
      In file included from /home/ysuenaga/github-forked/jdk/src/hotspot/share/runtime/frame.inline.hpp:42,
                       from /home/ysuenaga/github-forked/jdk/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp:29:
      /home/ysuenaga/github-forked/jdk/src/hotspot/cpu/x86/frame_x86.inline.hpp: In member function 'oop frame::saved_oop_result(RegisterMap*) const':
      /home/ysuenaga/github-forked/jdk/src/hotspot/cpu/x86/frame_x86.inline.hpp:231:42: error: 'this' pointer is null [-Werror=nonnull]
        231 | oop* result_adr = (oop *)map->location(rax->as_VMReg());
            | ^~~
      In file included from /home/ysuenaga/github-forked/jdk/src/hotspot/share/code/vmreg.inline.hpp:31,
                       from /home/ysuenaga/github-forked/jdk/src/hotspot/cpu/x86/macroAssembler_x86.hpp:29,
                       from /home/ysuenaga/github-forked/jdk/src/hotspot/share/asm/macroAssembler.hpp:31,
                       from /home/ysuenaga/github-forked/jdk/src/hotspot/share/interpreter/interp_masm.hpp:28,
                       from /home/ysuenaga/github-forked/jdk/src/hotspot/share/interpreter/interpreter.hpp:29,
                       from /home/ysuenaga/github-forked/jdk/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp:27:
      /home/ysuenaga/github-forked/jdk/src/hotspot/cpu/x86/vmreg_x86.inline.hpp:28:14: note: in a call to non-static member function 'VMRegImpl* RegisterImpl::as_VMReg()'
         28 | inline VMReg RegisterImpl::as_VMReg() {
            | ^~~~~~~~~~~~
      In file included from /home/ysuenaga/github-forked/jdk/src/hotspot/share/runtime/frame.inline.hpp:42,
                       from /home/ysuenaga/github-forked/jdk/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp:29:
      /home/ysuenaga/github-forked/jdk/src/hotspot/cpu/x86/frame_x86.inline.hpp: In member function 'void frame::set_saved_oop_result(RegisterMap*, oop)':
      /home/ysuenaga/github-forked/jdk/src/hotspot/cpu/x86/frame_x86.inline.hpp:238:42: error: 'this' pointer is null [-Werror=nonnull]
        238 | oop* result_adr = (oop *)map->location(rax->as_VMReg());
            | ^~~
      In file included from /home/ysuenaga/github-forked/jdk/src/hotspot/share/code/vmreg.inline.hpp:31,
                       from /home/ysuenaga/github-forked/jdk/src/hotspot/cpu/x86/macroAssembler_x86.hpp:29,
                       from /home/ysuenaga/github-forked/jdk/src/hotspot/share/asm/macroAssembler.hpp:31,
                       from /home/ysuenaga/github-forked/jdk/src/hotspot/share/interpreter/interp_masm.hpp:28,
                       from /home/ysuenaga/github-forked/jdk/src/hotspot/share/interpreter/interpreter.hpp:29,
                       from /home/ysuenaga/github-forked/jdk/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp:27:
      /home/ysuenaga/github-forked/jdk/src/hotspot/cpu/x86/vmreg_x86.inline.hpp:28:14: note: in a call to non-static member function 'VMRegImpl* RegisterImpl::as_VMReg()'
         28 | inline VMReg RegisterImpl::as_VMReg() {
            | ^~~~~~~~~~~~
      cc1plus: all warnings being treated as errors
      ```

      `Register` ( `RegisterImpl` ) is defined as a class, but it is used like numerical value. For example `rax` and `xmm0` are assigned to `0`. It is the cause of this error.

      Logically, the code is fine, so we can avoid them to disable `-Wnonnull`.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ysuenaga Yasumasa Suenaga
              Reporter:
              ysuenaga Yasumasa Suenaga
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: