Opened 12 years ago

Closed 12 years ago

#2192 closed defect (fixed)

error during expanding of a slice subscript expression

Reported by: Lennart Ochel Owned by: somebody
Priority: high Milestone: 1.9.0
Component: Frontend Version: trunk
Keywords: Cc: Per Östlund, Adrian Pop, Lennart Ochel

Description

model bug
  Integer a[3];
  Real b[3];
  Real c[2];
  Integer n;
equation
  n = 2;
algorithm
  a := {1, 2, 3};
  b := {1.1, 2.1, 3.1};
  c := b[a[1:n]];
end bug;

OpenModelica Output:

messages = "Simulation failed for model: bug
Error: Internal error ComponentReference.expandSlice: Unknown slice a[1:n]
Error: Internal error ComponentReference.expandSlice: Unknown slice 1:n
Error: Internal error ComponentReference.expandSlice: Unknown slice a[1:2]
Error: Internal error ComponentReference.expandSlice: Unknown slice 1:2
Error: Internal error ComponentReference.expandSlice: Unknown slice a[1:2]
Error: Internal error ComponentReference.expandSlice: Unknown slice 1:2
Error: Internal error ComponentReference.expandSlice: Unknown slice a[1:2]
Error: Internal error ComponentReference.expandSlice: Unknown slice 1:2
Error: Internal error ComponentReference.expandSlice: Unknown slice a[1:2]
Error: Internal error ComponentReference.expandSlice: Unknown slice 1:2
Error: Internal error ComponentReference.expandSlice: Unknown slice a[1:2]
Error: Internal error ComponentReference.expandSlice: Unknown slice 1:2
Error: Internal error ComponentReference.expandSlice: Unknown slice a[1:2]
Error: Internal error ComponentReference.expandSlice: Unknown slice 1:2
Error: Internal error ComponentReference.expandSlice: Unknown slice a[1:2]
Error: Internal error ComponentReference.expandSlice: Unknown slice 1:2
[CodegenC.tpl:8632:38-8632:38:writable] Error: Template error: dimension: INVALID_DIMENSION n
"

I am not pretty sure if this is pure Modelica. Even dymola is not able to handle this model. But maybe that doesn't mean anything. So probably we should get this running.

Change History (2)

comment:1 by bernhard.bachmann@…, 12 years ago

This is correct Modelica and does work correctly in Dymola 2013 FD01. This functionality is important for supporting the Modelica Petri Net Library PNLib!

comment:2 by Per Östlund, 12 years ago

Resolution: fixed
Status: newclosed

Fixed in r16112.

Note: See TracTickets for help on using tickets.