clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name _num_threads.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -analyzer-output=html -analyzer-checker=python -analyzer-disable-checker=deadcode -analyzer-config prune-paths=true,suppress-c++-stdlib=true,suppress-null-return-paths=false,crosscheck-with-z3=true,model-path=/opt/pyrefcon/lib/pyrefcon/models/models -analyzer-config experimental-enable-naive-ctu-analysis=true,ctu-dir=/tmp/pyrefcon/numba/csa-scan,ctu-index-name=/tmp/pyrefcon/numba/csa-scan/externalDefMap.txt,ctu-invocation-list=/tmp/pyrefcon/numba/csa-scan/invocations.yaml,display-ctu-progress=false -setup-static-analyzer -analyzer-config-compatibility-mode=true -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=none -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -tune-cpu generic -debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb -fcoverage-compilation-dir=/tmp/pyrefcon/numba -resource-dir /opt/pyrefcon/lib/clang/13.0.0 -isystem /opt/pyrefcon/lib/pyrefcon/models/python3.8 -D NDEBUG -D _FORTIFY_SOURCE=2 -internal-isystem /opt/pyrefcon/lib/clang/13.0.0/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/10/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -Wno-unused-result -Wsign-compare -Wall -Wformat -Werror=format-security -Wformat -Werror=format-security -Wdate-time -fdebug-compilation-dir=/tmp/pyrefcon/numba -ferror-limit 19 -fwrapv -pthread -stack-protector 2 -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/pyrefcon/numba/csa-scan/reports -x c numba/np/ufunc/_num_threads.c
1 | |
2 | |
3 | |
4 | #include "../../_pymodule.h" |
5 | |
6 | #ifdef _MSC_VER |
7 | #define THREAD_LOCAL(ty) __declspec(thread) ty |
8 | #else |
9 | |
10 | #define THREAD_LOCAL(ty) __thread ty |
11 | #endif |
12 | |
13 | static THREAD_LOCAL(int) num_threads = 0; |
14 | |
15 | static void set_num_threads(int count) |
16 | { |
17 | num_threads = count; |
18 | } |
19 | |
20 | static int get_num_threads(void) |
21 | { |
22 | return num_threads; |
23 | } |
24 | |
25 | MOD_INIT(_num_threads) |
26 | { |
27 | PyObject *m; |
28 | MOD_DEF(m, "_num_threads", "No docs", NULL) |
29 | if (m == NULL) |
| 1 | Assuming 'm' is not equal to NULL | |
|
| |
30 | return MOD_ERROR_VAL; |
31 | PyObject_SetAttrString(m, "set_num_threads", |
32 | PyLong_FromVoidPtr((void*)&set_num_threads)); |
| 3 | | Calling 'PyLong_FromVoidPtr' | |
|
| 5 | | Returning from 'PyLong_FromVoidPtr' | |
|
| 6 | | PyObject ownership leak with reference count of 1 |
|
33 | PyObject_SetAttrString(m, "get_num_threads", |
34 | PyLong_FromVoidPtr((void*)&get_num_threads)); |
35 | |
36 | return MOD_SUCCESS_VAL(m); |
37 | } |