Bug Summary

File:OMCompiler/Compiler/runtime/BackendDAEEXT_omc.cpp
Warning:line 116, column 20
Value stored to 'nelts' during its initialization is never read

Annotated Source Code

[?] Use j/k keys for keyboard navigation

1/*
2 * This file is part of OpenModelica.
3 *
4 * Copyright (c) 1998-2010, Linköpings University,
5 * Department of Computer and Information Science,
6 * SE-58183 Linköping, Sweden.
7 *
8 * All rights reserved.
9 *
10 * THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THIS OSMC PUBLIC
11 * LICENSE (OSMC-PL). ANY USE, REPRODUCTION OR DISTRIBUTION OF
12 * THIS PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THE OSMC
13 * PUBLIC LICENSE.
14 *
15 * The OpenModelica software and the Open Source Modelica
16 * Consortium (OSMC) Public License (OSMC-PL) are obtained
17 * from Linköpings University, either from the above address,
18 * from the URL: http://www.ida.liu.se/projects/OpenModelica
19 * and in the OpenModelica distribution.
20 *
21 * This program is distributed WITHOUT ANY WARRANTY; without
22 * even the implied warranty of MERCHANTABILITY or FITNESS
23 * FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH
24 * IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS
25 * OF OSMC-PL.
26 *
27 * See the full OSMC Public License conditions for more details.
28 *
29 */
30
31/*
32 * file: BackendDAEEXT.cpp
33 * description: The BackendDAEEXT.cpp file is the external implementation of
34 * MetaModelica package: Compiler/BackendDAEEXT.mo.
35 * This is used for the BLT and index reduction algorithms in BackendDAE.
36 * The implementation mainly consists of several bitvectors implemented
37 * using std::vector<bool> since such functionality is not available in
38 * MetaModelica Compiler (MMC).
39 *
40 *
41 */
42
43#include "meta_modelica.h"
44#include "BackendDAEEXT.cpp"
45#include <stdlib.h>
46#include "errorext.h"
47
48extern "C" {
49
50extern int BackendDAEEXT_getVMark(int _inInteger)
51{
52 return BackendDAEEXTImpl__getVMark(_inInteger);
53}
54extern void* BackendDAEEXT_getMarkedEqns()
55{
56 return BackendDAEEXTImpl__getMarkedEqns();
57}
58extern void BackendDAEEXT_eMark(int _inInteger)
59{
60 BackendDAEEXTImpl__eMark(_inInteger);
61}
62extern void BackendDAEEXT_clearDifferentiated()
63{
64 BackendDAEEXTImpl__clearDifferentiated();
65}
66extern void* BackendDAEEXT_getDifferentiatedEqns()
67{
68 return BackendDAEEXTImpl__getDifferentiatedEqns();
69}
70extern int BackendDAEEXT_getLowLink(int _inInteger)
71{
72 return BackendDAEEXTImpl__getLowLink(_inInteger);
73}
74extern void* BackendDAEEXT_getMarkedVariables()
75{
76 return BackendDAEEXTImpl__getMarkedVariables();
77}
78extern int BackendDAEEXT_getNumber(int _inInteger)
79{
80 return BackendDAEEXTImpl__getNumber(_inInteger);
81}
82extern void BackendDAEEXT_setNumber(int _inInteger1, int _inInteger2)
83{
84 BackendDAEEXTImpl__setNumber(_inInteger1, _inInteger2);
85}
86extern void BackendDAEEXT_initMarks(int _inInteger1, int _inInteger2)
87{
88 BackendDAEEXTImpl__initMarks(_inInteger1, _inInteger2);
89}
90extern void BackendDAEEXT_initLowLink(int _inInteger)
91{
92 BackendDAEEXTImpl__initLowLink(_inInteger);
93}
94extern void BackendDAEEXT_markDifferentiated(int _inInteger)
95{
96 BackendDAEEXTImpl__markDifferentiated(_inInteger);
97}
98extern void BackendDAEEXT_initNumber(int _inInteger)
99{
100 BackendDAEEXTImpl__initNumber(_inInteger);
101}
102extern void BackendDAEEXT_setLowLink(int _inInteger1, int _inInteger2)
103{
104 BackendDAEEXTImpl__setLowLink(_inInteger1, _inInteger2);
105}
106extern void BackendDAEEXT_vMark(int _inInteger)
107{
108 BackendDAEEXTImpl__vMark(_inInteger);
109}
110
111extern void BackendDAEEXT_setAdjacencyMatrix(modelica_integer nvars, modelica_integer neqns, modelica_integer nz, modelica_metatype adjacencymatrix)
112{
113 int i=0;
114 mmc_sint_t i1;
115 int j=0;
116 modelica_integer nelts = MMC_HDRSLOTS(MMC_GETHDR(adjacencymatrix))((((((*(mmc_uint_t*)((void*)((char*)(adjacencymatrix) - 3))))
& (7)) == 5)) ? ((((*(mmc_uint_t*)((void*)((char*)(adjacencymatrix
) - 3)))) >> (3+3))) : (((*(mmc_uint_t*)((void*)((char*
)(adjacencymatrix) - 3)))) >> 10))
;
Value stored to 'nelts' during its initialization is never read
117
118 if (col_ptrs) free(col_ptrs);
119 col_ptrs = (int*) malloc((neqns+1) * sizeof(int));
120 col_ptrs[neqns]=nz;
121 if (col_ids) free(col_ids);
122 col_ids = (int*) malloc(nz * sizeof(int));
123
124 for(i=0; i<neqns; ++i) {
125 modelica_metatype ie = MMC_STRUCTDATA(adjacencymatrix)(((struct mmc_struct*)((void*)((char*)(adjacencymatrix) - 3))
)->data)
[i];
126 col_ptrs[i] = j;
127 while(MMC_GETHDR(ie)(*(mmc_uint_t*)((void*)((char*)(ie) - 3))) == MMC_CONSHDR(((2) << 10) + (((1) & 255) << 2))) {
128 i1 = MMC_UNTAGFIXNUM(MMC_CAR(ie))(((mmc_sint_t) ((*(void**)(((void*)((void**)(((void*)((char*)
(ie) - 3))) + (1))))))) >> 1)
;
129 if (i1>0) {
130 col_ids[j++] = (int)i1-1;
131 }
132 ie = MMC_CDR(ie)(*(void**)(((void*)((void**)(((void*)((char*)(ie) - 3))) + (2
)))))
;
133 }
134 }
135}
136
137extern void BackendDAEEXT_matching(modelica_integer nv, modelica_integer ne, modelica_integer matchingID, modelica_integer cheapID, modelica_real relabel_period, modelica_integer clear_match)
138{
139 int i=0;
140 BackendDAEExtImpl__matching(nv, ne, matchingID, cheapID, relabel_period, clear_match);
141}
142
143extern void BackendDAEEXT_getAssignment(modelica_metatype ass1, modelica_metatype ass2)
144{
145 int i=0;
146 mmc_uint_t len1 = MMC_HDRSLOTS(MMC_GETHDR(ass1))((((((*(mmc_uint_t*)((void*)((char*)(ass1) - 3)))) & (7))
== 5)) ? ((((*(mmc_uint_t*)((void*)((char*)(ass1) - 3)))) >>
(3+3))) : (((*(mmc_uint_t*)((void*)((char*)(ass1) - 3)))) >>
10))
;
147 mmc_uint_t len2 = MMC_HDRSLOTS(MMC_GETHDR(ass2))((((((*(mmc_uint_t*)((void*)((char*)(ass2) - 3)))) & (7))
== 5)) ? ((((*(mmc_uint_t*)((void*)((char*)(ass2) - 3)))) >>
(3+3))) : (((*(mmc_uint_t*)((void*)((char*)(ass2) - 3)))) >>
10))
;
148 if (n > len1 || m > len2) {
149 char nstr[64],mstr[64],len1str[64],len2str[64];
150 const char *tokens[4] = {len2str,mstr,len1str,nstr};
151 snprintf(nstr,64,"%ld", (long) n);
152 snprintf(mstr,64,"%ld", (long) m);
153 snprintf(len1str,64,"%ld", (long) len1);
154 snprintf(len2str,64,"%ld", (long) len2);
155 c_add_message(NULL__null,-1,ErrorType_symbolic,ErrorLevel_internal,"BackendDAEEXT.getAssignment failed because n=%s>arrayLength(ass1)=%s or m=%s>arrayLength(ass2)=%s",tokens,4);
156 MMC_THROW(){longjmp(*((threadData_t*)pthread_getspecific(mmc_thread_data_key
))->mmc_jumper,1);}
;
157 }
158 if (match != NULL__null) {
159 for(i=0; i<n; ++i) {
160 if (match[i] >= 0)
161 MMC_STRUCTDATA(ass1)(((struct mmc_struct*)((void*)((char*)(ass1) - 3)))->data)[i] = mmc_mk_icon(match[i]+1);
162 else
163 MMC_STRUCTDATA(ass1)(((struct mmc_struct*)((void*)((char*)(ass1) - 3)))->data)[i] = mmc_mk_icon(-1);
164 }
165 }
166 if (row_match != NULL__null) {
167 for(i=0; i<m; ++i) {
168 if (row_match[i] >= 0)
169 MMC_STRUCTDATA(ass2)(((struct mmc_struct*)((void*)((char*)(ass2) - 3)))->data)[i] = mmc_mk_icon(row_match[i]+1);
170 else
171 MMC_STRUCTDATA(ass2)(((struct mmc_struct*)((void*)((char*)(ass2) - 3)))->data)[i] = mmc_mk_icon(-1);
172 }
173 }
174}
175
176extern int BackendDAEEXT_setAssignment(int lenass1, int lenass2, modelica_metatype ass1, modelica_metatype ass2)
177{
178 int nelts=0;
179 int i=0;
180
181 nelts = MMC_HDRSLOTS(MMC_GETHDR(ass1))((((((*(mmc_uint_t*)((void*)((char*)(ass1) - 3)))) & (7))
== 5)) ? ((((*(mmc_uint_t*)((void*)((char*)(ass1) - 3)))) >>
(3+3))) : (((*(mmc_uint_t*)((void*)((char*)(ass1) - 3)))) >>
10))
;
182 if (nelts > 0) {
183 n = lenass1;
184 if(match) {
185 free(match);
186 }
187 match = (int*) malloc(n * sizeof(int));
188 for(i=0; i<n; ++i) {
189 match[i] = MMC_UNTAGFIXNUM(MMC_STRUCTDATA(ass1)[i])(((mmc_sint_t) ((((struct mmc_struct*)((void*)((char*)(ass1) -
3)))->data)[i])) >> 1)
-1;
190 if (match[i]<0) match[i] = -1;
191 }
192 }
193 nelts = MMC_HDRSLOTS(MMC_GETHDR(ass2))((((((*(mmc_uint_t*)((void*)((char*)(ass2) - 3)))) & (7))
== 5)) ? ((((*(mmc_uint_t*)((void*)((char*)(ass2) - 3)))) >>
(3+3))) : (((*(mmc_uint_t*)((void*)((char*)(ass2) - 3)))) >>
10))
;
194 if (nelts > 0) {
195 m = lenass2;
196 if(row_match) {
197 free(row_match);
198 }
199 row_match = (int*) malloc(m * sizeof(int));
200 for(i=0; i<m; ++i) {
201 row_match[i] = MMC_UNTAGFIXNUM(MMC_STRUCTDATA(ass2)[i])(((mmc_sint_t) ((((struct mmc_struct*)((void*)((char*)(ass2) -
3)))->data)[i])) >> 1)
-1;
202 if (row_match[i]<0) row_match[i] = -1;
203 }
204 }
205 return 1;
206}
207
208}