Opened 11 years ago
Closed 3 years ago
#2214 closed defect (fixed)
code generation for iteration variable
Reported by: | Lennart Ochel | Owned by: | Per Östlund |
---|---|---|---|
Priority: | high | Milestone: | 1.19.0 |
Component: | Code Generation | Version: | trunk |
Keywords: | Cc: | Lennart Ochel, Willi Braun |
Description
I found some issues using blocks. OpenModelica cannot simulate the model test from the following package.
package bug_2213 block anyChange "does any entry of a boolean vector change its value?" input Boolean vec[:]; output Boolean anychange; algorithm anychange:=false; for i in 1:size(vec, 1) loop anychange:=anychange or change(vec[i]); end for; end anyChange; model test Boolean b[3]; anyChange ac(vec=b); Integer i(start=0, fixed=true); equation b[1] = time > 0.1; b[2] = time > 0.2; b[3] = time > 0.3; when ac.anychange then i = pre(i) + 1; end when; end test; end bug_2213;
(see also #2213)
The issue is that we get in conflict with the variable name i in the generated c-code.
Change History (12)
comment:2 by , 11 years ago
There is no strong need to fix this for me. I can easily avoid such conflicts in my models ;-). It is just good to know about this.
comment:3 by , 11 years ago
Milestone: | 1.9.0 → 2.0.0 |
---|
comment:8 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.
follow-up: 10 comment:9 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
@perost, can you please comment on comment:1?
comment:10 by , 7 years ago
comment:11 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.
comment:12 by , 3 years ago
Milestone: | Future → 1.19.0 |
---|---|
Resolution: | → fixed |
Status: | assigned → closed |
It seems this was fixed at some point, the model now compiles without any issues.
This is an old known bug. Also look in our code for CREF_ITER, which the new frontend is supposed to use in order to avoid conflicts.
If there is a strong need it can probably also be implemented in the old frontend, but it is a lot of work.