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

-Wformat-overflow is reported from GCC 9

XMLWordPrintable

    • gc
    • b28
    • linux

        I saw format-overflow warnings in g1GCPhaseTimes.cpp when I built jdk/jdk with GCC 9 on Fedora 31 as below:

        ------------------
        In member function 'void G1GCPhaseTimes::log_phase(WorkerDataArray<double>*, uint, outputStream*, bool) const',
            inlined from 'void G1GCPhaseTimes::trace_phase(WorkerDataArray<double>*, bool, uint) const' at /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp:339:14:
        /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp:319:17: error: '%s' directive argument is null [-Werror=format-overflow=]
          319 | out->print("%s", Indents[indent + 1]);
              | ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
        In member function 'void G1GCPhaseTimes::details(T*, const char*) const [with T = WorkerDataArray<long unsigned int>]',
            inlined from 'void G1GCPhaseTimes::log_phase(WorkerDataArray<double>*, uint, outputStream*, bool) const' at /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp:321:14,
            inlined from 'void G1GCPhaseTimes::trace_phase(WorkerDataArray<double>*, bool, uint) const' at /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp:339:14:
        /home/ysuenaga/OpenJDK/jdk/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp:306:13: error: '%s' directive argument is null [-Werror=format-overflow=]
          306 | ls.print("%s", indent);
              |
        ------------------

        I used gcc-9.2.1-1.fc31.x86_64.

        -Wformat-overflow has been extended since GCC 9.
        https://gcc.gnu.org/gcc-9/changes.html

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

                Created:
                Updated:
                Resolved: