[llvm-dev] False positive about Use of memory after it is freed for OpenJDK

Leslie Zhai via llvm-dev llvm-dev at lists.llvm.org
Thu Feb 28 05:29:30 PST 2019


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 :)

Cheers,

Leslie Zhai

[1] 
http://hg.openjdk.java.net/jdk/jdk12/file/0276cba45aac/src/java.base/share/native/libverify/check_code.c#l1328

[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




More information about the llvm-dev mailing list