Opened 12 years ago

Closed 11 years ago

#2112 closed defect (fixed)

runtime handling of array assignments

Reported by: lochel Owned by: somebody
Priority: blocker Milestone: 1.9.0
Component: Run-time Version: trunk
Keywords: Cc: lochel, wbraun, jfrenkel, mahge930

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 Changed 12 years ago by lochel

  • Cc wbraun jfrenkel added

comment:2 Changed 12 years ago by wbraun

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

ups, wrong ticket.

Last edited 12 years ago by wbraun (previous) (diff)

comment:3 Changed 12 years ago by wbraun

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:4 Changed 11 years ago by lochel

  • Cc mahge930 added

comment:5 Changed 11 years ago by lochel

  • Priority changed from high to blocker

comment:6 Changed 11 years ago by lochel

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

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

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.