Opened 12 years ago

Closed 12 years ago

#2112 closed defect (fixed)

runtime handling of array assignments

Reported by: Lennart Ochel Owned by: somebody
Priority: blocker Milestone: 1.9.0
Component: Run-time Version: trunk
Keywords: Cc: Lennart Ochel, Willi Braun, Jens Frenkel, Mahder Alemseged Gebremedhin

Description

model test
  Real y[5];
algorithm 
  y[1:5] := fill(2, 5);
end test;

Simulation message

index spec dimensions and array dimensions do not agree 1 != 0
test: util/real_array.c:322: indexed_assign_real_array: Assertion `index_spec_fit_base_array(dest_spec, dest)' failed.
Aborted (core dumped)

Change History (7)

comment:1 by Lennart Ochel, 12 years ago

Cc: Willi Braun Jens Frenkel added

comment:2 by Willi Braun, 12 years ago

Resolution: fixed
Status: newclosed

Fixed in r15522.

Version 0, edited 12 years ago by Willi Braun (next)

comment:3 by Willi Braun, 12 years ago

Resolution: fixed
Status: closedreopened

comment:4 by Lennart Ochel, 12 years ago

Cc: Mahder Alemseged Gebremedhin added

comment:5 by Lennart Ochel, 12 years ago

Priority: highblocker

comment:6 by Lennart Ochel, 12 years ago

There are uninitialized tmp-arrays. For example tmp4 is used uninitialized in the following function:

static void eqFunction_1(DATA *data)
{
  real_array tmp0;
  integer_array tmp1;
  modelica_integer tmp2;
  index_spec_t tmp3;
  real_array tmp4;
  array_alloc_scalar_real_array(&tmp0, 5, (modelica_real)2.0, (modelica_real)2.0, (modelica_real)2.0, (modelica_real)2.0, (modelica_real)2.0);
  array_alloc_scalar_integer_array(&tmp1, 5, (modelica_integer)(modelica_integer) 1, (modelica_integer)(modelica_integer) 2, (modelica_integer)(modelica_integer) 3, (modelica_integer)(modelica_integer) 4, (modelica_integer)(modelica_integer) 5);
  tmp2 = size_of_dimension_integer_array(tmp1, 1);
  create_index_spec(&tmp3, 1, (int) tmp2, integer_array_make_index_array(&tmp1), 'A');
  indexed_assign_real_array(&tmp0, &tmp4, &tmp3);
  copy_real_array_data_mem(&tmp4, &$Py);
}

That should be quite easy to fix. But the whole array-handling is a bit strange and confusing in the c-runtime. … maybe someone who has already worked with that stuff can have a look at it (Mahder?).
However, I will try to fix it.

comment:7 by Lennart Ochel, 12 years ago

Resolution: fixed
Status: reopenedclosed

Fixed in r15979. Pprobably it is not the best solution. It would be good if someone with a better overview of the whole array-handling can revise my commit.

Note: See TracTickets for help on using tickets.