Opened 10 years ago

Closed 10 years ago

#2896 closed defect (fixed)

Looping over list array element doesn't work correctly

Reported by: Per Östlund Owned by: Martin Sjölund
Priority: high Milestone: 1.9.1
Component: MetaModelica Version: trunk
Keywords: Cc:

Description

Calling this function:

function test
protected
  array<list<Integer>> a;
algorithm 
  a := arrayCreate(1, {1, 2, 3});
  for i in a[1] loop
    print("i = " + intString(i) + "\n");
  end for;
end test;

gives the output:

i = 1
i = 70330909930353

which is not quite the expected result.

Change History (3)

comment:1 by Per Östlund, 10 years ago

Aha, it thinks a[1] is an array, and generates code for that. Replacing a[1] with arrayGet(a, 1) works.

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

Yeah, for i in /*array<list<#Integer>>*/ a[1] loop is the wrong type.

comment:3 by Martin Sjölund, 10 years ago

Milestone: Bootstrapping1.9.1
Resolution: fixed
Status: newclosed

Fixed simplify in r22766.

Note: See TracTickets for help on using tickets.