Opened 11 years ago

Closed 11 years ago

#2300 closed defect (fixed)

empty array

Reported by: lochel Owned by: adrpo
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 Changed 11 years ago by lochel

  • Priority changed from high to blocker

This blocks the Petri net library.

comment:2 Changed 11 years ago by adrpo

  • Owner changed from somebody to adrpo
  • Status changed from new to assigned

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 Changed 11 years ago by adrpo

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed in r16883.

Note: See TracTickets for help on using tickets.