False positive about Use of memory after it is freed for OpenJDK

Hi,

Sorry that I failed to subscribe cfe-dev mailing list, so I just post in llvm-dev instead.

Bug reported by the clang static analyzer.

Description: Use of memory after it is freed
File: /home/loongson/zhaixiang/jdk12-mips-llvm/src/java.base/share/native/libverify/check_code.c[1]
Line: 1328

Preprocessed file[2] is available.

I argue that Use of memory after it is freed is *False Positive*

----- 8< -------- 8< -------- 8< -------- 8< -------- 8< -------- 8< ---
src/java.base/share/native/libverify/check_code.c:1328:22: warning: Use of memory after it is freed
         clazz_info = cp_index_to_class_fullinfo(context, key,
                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- 8< -------- 8< -------- 8< -------- 8< -------- 8< -------- 8< ---

Full analyzer log and invocation[3] is available too. Please change include file path, for example, /home/loongson/zhaixiang/jdk12-mips-llvm/src/java.base/share/native/libjava change to YOUR_OPENJDK_SRC_DIR/src/java.base/share/native/libjava

Perhaps it doesn't need to include the *build* directories, otherwise it is difficult to reproduce the issue :slight_smile:

Cheers,

Leslie Zhai

[1] jdk/jdk12: 0276cba45aac src/java.base/share/native/libverify/check_code.c

[2] https://raw.githubusercontent.com/xiangzhai/jdk-dev/master/check_code.c

[3] https://raw.githubusercontent.com/xiangzhai/jdk-dev/master/check_code_analyzer.log

Filed https://bugs.llvm.org/show_bug.cgi?id=40913

Cheers,

Leslie Zhai