#3422 closed defect (fixed)
Invalid for loop range in ModelicaCompliance.Algorithms.For.ArrayRange is not detected
Reported by: | Henrik Tidefelt | Owned by: | Martin Sjölund |
---|---|---|---|
Priority: | normal | Milestone: | 1.9.4 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: |
Description
Validation of ModelicaCompliance.Algorithms.For.ArrayRange gives no indication of an error in the model, but the purpose of the model is to check enforcement of the rule in section 11.2.2 that the loop range must be vector expression.
model ArrayRange Real x[4, 2]; algorithm for elem in {{1, 2}, {3, 4}, {5, 6}, {7, 8}} loop x[div(elem[2], 2), :] := elem; end for; annotation(__ModelicaAssociation(TestCase(shouldPass = false, section = {"11.2.2"})), experiment(StopTime = 0.01), Documentation(info = "<html>Tests that the range of a for-statement must be a vector expression, i.e. it should have exactly one dimension.</html>")); end ArrayRange;
Change History (7)
comment:1 by , 9 years ago
Component: | Unknown → Frontend |
---|---|
Owner: | changed from | to
Status: | new → accepted |
comment:2 by , 9 years ago
Milestone: | Future → 1.9.4 |
---|---|
Resolution: | → fixed |
Status: | accepted → closed |
comment:3 by , 9 years ago
Nice!
On the other hand, isn't it totally confusing that one can iterate over vectors of many things, except arrays? I mean, are we sure that this was really the intention of the specification?
comment:5 by , 9 years ago
The closest match i find is https://trac.modelica.org/Modelica/ticket/370, but it doesn't contain any complaints regarding the interpretation of vector expression.
Note:
See TracTickets
for help on using tickets.
Fixed in 555db14. A testcase was added.