clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name callvirtualmethod.cxx -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -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 -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=all -relaxed-aliasing -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-feature -avx -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D LINUX -D OSL_DEBUG_LEVEL=1 -D SAL_LOG_INFO -D SAL_LOG_WARN -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D HAVE_POSIX_FALLOCATE -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/bridges/inc -I /home/maarten/src/libreoffice/core/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include/linux -I /home/maarten/src/libreoffice/core/config_host -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/comprehensive -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-missing-braces -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/maarten/src/libreoffice/core -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -debug-info-kind=constructor -analyzer-output=html -faddrsig -o /home/maarten/tmp/wis/scan-build-libreoffice/output/report/2020-10-07-141433-9725-1 -x c++ /home/maarten/src/libreoffice/core/bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
18 | |
19 | |
20 | #include <sal/config.h> |
21 | |
22 | #include <cstring> |
23 | |
24 | #include <cppu/macros.hxx> |
25 | #include <sal/types.h> |
26 | #include <typelib/typeclass.h> |
27 | #include <typelib/typedescription.h> |
28 | |
29 | #include "abi.hxx" |
30 | #include "callvirtualmethod.hxx" |
31 | |
32 | |
33 | |
34 | |
35 | |
36 | |
37 | |
38 | |
39 | |
40 | |
41 | |
42 | |
43 | |
44 | |
45 | |
46 | |
47 | |
48 | void CPPU_CURRENT_NAMESPACE::callVirtualMethod( |
49 | void * pThis, sal_uInt32 nVtableIndex, void * pRegisterReturn, |
50 | typelib_TypeDescriptionReference * pReturnTypeRef, bool bSimpleReturn, |
51 | sal_uInt64 *pStack, sal_uInt32 nStack, sal_uInt64 *pGPR, double * pFPR) |
52 | { |
53 | |
54 | |
55 | struct Data { |
56 | sal_uInt64 pMethod; |
57 | sal_uInt64 * pStack; |
58 | sal_uInt32 nStack; |
59 | sal_uInt64 * pGPR; |
60 | double * pFPR; |
61 | |
62 | sal_uInt64 rax; |
63 | sal_uInt64 rdx; |
64 | double xmm0; |
65 | double xmm1; |
66 | } data; |
67 | data.pStack = pStack; |
68 | data.nStack = nStack; |
69 | data.pGPR = pGPR; |
70 | data.pFPR = pFPR; |
71 | |
72 | |
73 | sal_uInt64 pMethod = *static_cast<sal_uInt64 *>(pThis); |
74 | pMethod += 8 * nVtableIndex; |
75 | data.pMethod = *reinterpret_cast<sal_uInt64 *>(pMethod); |
76 | |
77 | asm volatile ( |
78 | |
79 | "movq %%rsp, %%r12\n\t" |
80 | "movl 16%0, %%ecx\n\t" |
81 | "jrcxz .Lpushed\n\t" |
82 | "xor %%rax, %%rax\n\t" |
83 | "leaq (%%rax, %%rcx, 8), %%rax\n\t" |
84 | "subq %%rax, %%rsp\n\t" |
85 | "andq $-9, %%rsp\n\t" |
86 | "movq 8%0, %%rsi\n\t" |
87 | "\n.Lpush:\n\t" |
88 | "decq %%rcx\n\t" |
89 | "movq (%%rsi, %%rcx, 8), %%rax\n\t" |
90 | "movq %%rax, (%%rsp, %%rcx, 8)\n\t" |
91 | "jnz .Lpush\n\t" |
92 | "\n.Lpushed:\n\t" |
93 | |
94 | |
95 | "movq 32%0, %%rax\n\t" |
96 | |
97 | "movsd (%%rax), %%xmm0\n\t" |
98 | "movsd 8(%%rax), %%xmm1\n\t" |
99 | "movsd 16(%%rax), %%xmm2\n\t" |
100 | "movsd 24(%%rax), %%xmm3\n\t" |
101 | "movsd 32(%%rax), %%xmm4\n\t" |
102 | "movsd 40(%%rax), %%xmm5\n\t" |
103 | "movsd 48(%%rax), %%xmm6\n\t" |
104 | "movsd 56(%%rax), %%xmm7\n\t" |
105 | |
106 | |
107 | "movq 24%0, %%rax\n\t" |
108 | |
109 | "movq (%%rax), %%rdi\n\t" |
110 | "movq 8(%%rax), %%rsi\n\t" |
111 | "movq 16(%%rax), %%rdx\n\t" |
112 | "movq 24(%%rax), %%rcx\n\t" |
113 | "movq 32(%%rax), %%r8\n\t" |
114 | "movq 40(%%rax), %%r9\n\t" |
115 | |
116 | |
117 | "movq 0%0, %%r11\n\t" |
118 | "call *%%r11\n\t" |
119 | |
120 | |
121 | "movq %%rax, 40%0\n\t" |
122 | "movq %%rdx, 48%0\n\t" |
123 | "movsd %%xmm0, 56%0\n\t" |
124 | "movsd %%xmm1, 64%0\n\t" |
125 | |
126 | |
127 | "movq %%r12, %%rsp\n\t" |
128 | :: "o" (data) |
129 | : "rax", "rdi", "rsi", "rdx", "rcx", "r8", "r9", "r10", "r11", "r12", |
130 | "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7", |
131 | "xmm8", "xmm9", "xmm10", "xmm11", "xmm12", "xmm13", "xmm14", "xmm15", |
132 | "memory" |
133 | ); |
134 | |
135 | switch (pReturnTypeRef->eTypeClass) |
| 1 | Control jumps to 'case typelib_TypeClass_UNSIGNED_SHORT:' at line 148 | |
|
136 | { |
137 | case typelib_TypeClass_HYPER: |
138 | case typelib_TypeClass_UNSIGNED_HYPER: |
139 | *static_cast<sal_uInt64 *>( pRegisterReturn ) = data.rax; |
140 | break; |
141 | case typelib_TypeClass_LONG: |
142 | case typelib_TypeClass_UNSIGNED_LONG: |
143 | case typelib_TypeClass_ENUM: |
144 | *static_cast<sal_uInt32 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt32*>( &data.rax ); |
145 | break; |
146 | case typelib_TypeClass_CHAR: |
147 | case typelib_TypeClass_SHORT: |
148 | case typelib_TypeClass_UNSIGNED_SHORT: |
149 | *static_cast<sal_uInt16 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt16*>( &data.rax ); |
| 2 | | Assigned value is garbage or undefined |
|
150 | break; |
151 | case typelib_TypeClass_BOOLEAN: |
152 | case typelib_TypeClass_BYTE: |
153 | *static_cast<sal_uInt8 *>( pRegisterReturn ) = *reinterpret_cast<sal_uInt8*>( &data.rax ); |
154 | break; |
155 | case typelib_TypeClass_FLOAT: |
156 | case typelib_TypeClass_DOUBLE: |
157 | *static_cast<double *>( pRegisterReturn ) = data.xmm0; |
158 | break; |
159 | default: |
160 | { |
161 | sal_Int32 const nRetSize = pReturnTypeRef->pType->nSize; |
162 | if (bSimpleReturn && nRetSize <= 16 && nRetSize > 0) |
163 | { |
164 | sal_uInt64 longs[2]; |
165 | longs[0] = data.rax; |
166 | longs[1] = data.rdx; |
167 | |
168 | double doubles[2]; |
169 | doubles[0] = data.xmm0; |
170 | doubles[1] = data.xmm1; |
171 | x86_64::fill_struct( pReturnTypeRef, &longs[0], &doubles[0], pRegisterReturn); |
172 | } |
173 | break; |
174 | } |
175 | } |
176 | } |
177 | |
178 | |