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

[GCC static analyzer] GcInfoBuilder.c:296:20: warning: check of 'gc_stat.gc_ext_attribute_values' for NULL after already dereferencing it

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 26
    • core-svc
    • None

      When using the gcc static analyzer (fanalyzer) with gcc 13.2, the following issue is reported :

      jdk/src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c:296:20: warning: check of 'gc_stat.gc_ext_attribute_values' for NULL after already dereferencing it [-Wanalyzer-deref-before-check]
        296 | if (gc_stat.gc_ext_attribute_values != NULL) {

      Indeed we use a few line above
      https://github.com/openjdk/jdk/blob/1d53ac30f1db88df9a97b63b3ff56d26975d3a57/src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c#L269
      already the value with NULL check, so we should align the usage of NULL checks in the Java_com_sun_management_internal_GcInfoBuilder_getLastGcInfo0 function .

            Unassigned Unassigned
            mbaesken Matthias Baesken
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: