Opened 7 years ago

Closed 6 years ago

#4760 closed defect (fixed)

Issue with arrays in codegen when using the NF

Reported by: casella Owned by: perost
Priority: high Milestone: 2.0.0
Component: New Instantiation Version:
Keywords: Cc:

Description

Please check https://libraries.openmodelica.org/branches/newInst/Modelica_3.2.2/files/Modelica_3.2.2_Modelica.Blocks.Examples.NoiseExamples.Distributions.err Modelica.Blocks.Examples.NoiseExamples.Distributions. The following error is obtained:

[CodegenCFunctions.tpl:4819:15-4819:15:writable] Error: Template error:
This should have been handled in indexed assign and should not have gotten here.
state[1:2].
[CodegenCFunctions.tpl:4819:15-4819:15:writable] Error: Template error:
This should have been handled in indexed assign and should not have gotten here. 
state[i:i + 1].

Apparently, something's wrong in the NF-generated DAE structure that the back-end does not handle as expected.

Change History (2)

comment:1 Changed 6 years ago by casella

Apparently, the offending code is the statement

  state[i:i+1] := aux;

inside function initialStateWithXorshift64star. The old FE expanded the righ-hand-side to

    state[i:1 + i] := {aux[1], aux[2]};

while the NF keeps the same expression as in the original code.

I'm not sure if the NF or the code generation needs to be updated here.

comment:2 Changed 6 years ago by perost

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

Fixed in 801639b. Not expanding the rhs seems to work fine, the actual issue was that the assignment wasn't marked as an array assignment.

Note: See TracTickets for help on using tickets.