Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#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 Martin Sjölund, 9 years ago

Component: UnknownFrontend
Owner: changed from somebody to Martin Sjölund
Status: newaccepted

comment:2 by Martin Sjölund, 9 years ago

Milestone: Future1.9.4
Resolution: fixed
Status: acceptedclosed

Fixed in 555db14. A testcase was added.

comment:3 by Henrik Tidefelt, 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:4 by Martin Sjölund, 9 years ago

trac.modelica.org might have the answer :)

comment:5 by Henrik Tidefelt, 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.

comment:6 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.4-1.9.x

Milestone renamed

comment:7 by Martin Sjölund, 9 years ago

Milestone: 1.9.4-1.9.x1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.