Opened 11 years ago

Closed 11 years ago

#2300 closed defect (fixed)

empty array

Reported by: Lennart Ochel Owned by: Adrian Pop
Priority: blocker Milestone: 1.9.0
Component: Frontend Version: trunk
Keywords: Cc:

Description

The following model works fine:

model emptyArray1
  parameter Integer N = 0;
  Real r1[N];
  Real r2[N];
equation 
  r1 = fill(1.0, N);
equation
  r2 = r1;
end emptyArray1;

The model fails if the second equation get replaced with an algorithm:

model emptyArray2
  parameter Integer N = 0;
  Real r1[N];
  Real r2[N];
equation 
  r1 = fill(1.0, N);
algorithm 
  r2 := r1;
end emptyArray2;

InstantiateModel produces the following code for model emptyArray2:

class emptyArray2
  parameter Integer N = 0;
algorithm
  r2 := {};
end emptyArray2;

The problem is that there occurs a variable without definition (r2).

Change History (3)

comment:1 by Lennart Ochel, 11 years ago

Priority: highblocker

This blocks the Petri net library.

comment:2 by Adrian Pop, 11 years ago

Owner: changed from somebody to Adrian Pop
Status: newassigned

Yeah, for an equation we do remove it if it involves a zero array.
It seems we do not do the same for algorithms.
I'll have a look.

comment:3 by Adrian Pop, 11 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r16883.

Note: See TracTickets for help on using tickets.