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

GCC 12 fails to build zReferenceProcessor.cpp

    XMLWordPrintable

Details

    • gc
    • b28

    Backports

      Description

        When compiling with GCC 12.1.1 (current in Fedora rawhide), the following warning-as-error is produced and breaks the build by default:

        ```
        /home/test/shipilev-jdk/src/hotspot/share/gc/z/zReferenceProcessor.cpp: In member function 'oopDesc* ZReferenceProcessor::drop(oop, ReferenceType)':
        /home/test/shipilev-jdk/src/hotspot/share/gc/z/zReferenceProcessor.cpp:270:22: error: '%s' directive argument is null [-Werror=format-overflow=]
          270 | log_trace(gc, ref)("Dropped Reference: " PTR_FORMAT " (%s)", p2i(reference), reference_type_name(type));
              | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        ```

        The problem is over-zealous compiler seeing `NULL` from `ShouldNotReachHere()` block, and complaining about it. In this particular case, we can dodge this by returning a more reasonable constant on failure path.

        (This thing should be more reasonably handled when `ShouldNotReachHere()` is somehow `nonreturn`-ed, but Hotspot style doc is still undecided on this).

        Attachments

          Issue Links

            Activity

              People

                shade Aleksey Shipilev
                shade Aleksey Shipilev
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: