Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#5253 closed defect (fixed)

No error for unknown array size in non-inputs in functions

Reported by: Zimon Kuhs Owned by: Jesper Mattsson
Priority: major Milestone:
Component: Modelica/FrontEnd Version: trunk
Keywords: Cc:

Description

E.g. for

package P
  
function f
  input Integer n;
  input Integer v[:];
  Integer x[n];
  Integer y[:];
  Integer z[2];
  output Integer o;
algorithm
  o := v[1] + x[1] + y[1] + z[1];
  x := fill(-1, 2);
  y := ones(o);
  z := zeros(2);
end f;

model M
  Integer x = f(2, {2, 2});
end M;

model M2
  input Integer n;
  input Real a[:];
  Real b[:];
  output Real c[:];
equation
  b[:] = fill (n, size(a, 1));
  c = a;
end M2;
end P;

Change History (2)

comment:1 Changed 3 years ago by Zimon Kuhs

Resolution: fixed
Status: newclosed

changeset:9549

Added error for declaration of non-input arrays in functions.

comment:2 Changed 3 years ago by Jonathan Kämpe

changeset:9562

Reworked error check introduced in r9549 to be a bit nicer

Note: See TracTickets for help on using tickets.