Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#3386 closed defect (fixed)

Compile error with constant array

Reported by: crupp@… Owned by: somebody
Priority: high Milestone: 1.9.4
Component: *unknown* Version: trunk
Keywords: Cc:

Description

The following script fails at compile time.

loadString("
model constantarraybug
  constant Real[2, 6] phi = {{1, 2, 3, 4, 5, 6}, {21, 22, 23, 24, 25, 26}};
  Real[2] tmp;
  parameter Real[3] f = {0, 1, 0};
  parameter Real[3] t = {0, 0, -1};

equation
   tmp = phi[:, 1:3] * f + phi[:, 4:6] * t;
end constantarraybug;
");

buildModel(constantarraybug);

If the constant array is instead a parameter array then all works as expected. It also seems to only affect two dimensional arrays since the following works.

loadString("
model constantworks
  constant Real[6] phi = {21, 22, 23, 24, 25, 26};
  Real tmp;
  parameter Real[3] f = {0, 1, 0};
  parameter Real[3] t = {0, 0, -1};
equation
   tmp = phi[1:3] * f + phi[4:6] * t;
end constantworks;
");

buildModel(constantworks);

Tested in v1.9.3-dev-1158-g32bc683.

Change History (3)

comment:1 by Per Östlund, 9 years ago

Resolution: fixed
Status: newclosed

Fixed in 6fe518d.

comment:2 by Dietmar Winkler, 9 years ago

Milestone: Futurepre1.9.4

It doesn't make sense to keep closed ticket in the "Future" milestone that were simply forgotten to assign to the correct milestone in the past.

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

Milestone: pre1.9.41.9.4

Removing the pre1.9.4 milestone in favor of 1.9.4.

Note: See TracTickets for help on using tickets.