Opened 9 years ago
Last modified 7 years ago
#3495 accepted defect
Issue with array indices in generated code
Reported by: | Owned by: | Mahder Alemseged Gebremedhin | |
---|---|---|---|
Priority: | high | Milestone: | Future |
Component: | Code Generation | Version: | |
Keywords: | Cc: | Mahder Alemseged Gebremedhin |
Description
I get the following output by the simulation of a Petri net model:
C:/Users/TKLEIN~1/AppData/Local/Temp/OpenModelica/OMEdit/PNlib2.Examples.TestWkeit.exe -port=51187 -logFormat=xml -override=startTime=0,stopTime=5,stepSize=0.01,tolerance=1e-6,solver=dassl,outputFormat=mat,variableFilter=.* -r=PNlib2.Examples.TestWkeit_res.mat -dasslJacobian=coloredNumerical -w -lv=LOG_STATS scalar s->index[0][0] == 2456744 incorrect, a->dim_size[0] == 2 This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. Simulation process failed. Exited with code 255.
Attachments (1)
Change History (14)
by , 9 years ago
Attachment: | TestWkeitTotal.mo added |
---|
comment:1 by , 9 years ago
Component: | Unknown → Code Generation |
---|
comment:2 by , 9 years ago
The following model can be used as minimalistic test case to reproduce the issue:
model test function deleteElementInt "deletes an element of an integer vector" input Integer vecin[:]; input Integer idx; output Integer vecout[size(vecin,1)]; protected parameter Integer nVec= size(vecin,1); algorithm vecout[1:idx-1]:=vecin[1:idx-1]; vecout[idx:nVec-1]:=vecin[idx+1:nVec]; vecout[nVec]:=0; end deleteElementInt; Integer i[2]; algorithm i[1] := 3; i[2] := 4; i := deleteElementInt(i, 2); end test;
The error message is as follows:
Simulation execution failed for model: test scalar s->index[0][0] == 11636624 incorrect, a->dim_size[0] == 2 Aborted (core dumped)
comment:3 by , 9 years ago
Cc: | added |
---|---|
Milestone: | Future → 1.9.4 |
Priority: | high → critical |
Summary: | Doesn‘t simulate → Issue with array indices in generated code |
comment:4 by , 9 years ago
This line causes the error if idx == nVec
:
vecout[idx:nVec-1]:=vecin[idx+1:nVec];
comment:5 by , 9 years ago
Priority: | critical → high |
---|
I added a workaround to the PNlib (f6d864) which makes all atomic test cases working. However, it would be good to fix this anyway.
comment:6 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → accepted |
comment:7 by , 9 years ago
Mahder, can you please explain the issue? Do you think this could be fixed for milestone 1.9.4?
comment:12 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:13 by , 7 years ago
Milestone: | 1.12.0 → Future |
---|
The milestone of this ticket has been reassigned to "Future".
If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.
If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".
In both cases, a short informative comment would be welcome.
This is the error message that I get: