Hi all,

I was just debugging a strange sigsegv from omc and digging through the C-sources, when I saw the following:

  cat_alloc_real_array(1, &tmp74, 3, &tmp62, &tmp66, &tmp70);
tmp75 = _Modelica_Mechanics_MultiBody_Frames_Orientation(tmp74, _OMC_LIT14);
  _R = tmp75.Modelica_Mechanics_MultiBody_Frames_Orientation_rettype_1;
  /*#endModelicaLine*/

  _return:
  /* functionBodyRegularFunction: out var copy */
  /* functionBodyRegularFunction: state out */
  restore_memory_state(tmp2);
  /* functionBodyRegularFunction: out var assign */
  /* varOutput varAssign(_R) */
  tmp1.targ1 = _R;

Basically, this snippet creates an Orientation record as a function result. Afterwards the memory state is reset. This is ... bad. The pointers in the generated array (tmp74 in this case) point somewhere in the "free" list now.

Does this mean, it is generally not supported by omc to return arrays from functions? And if so, what is the workaround?

My svn revision is r10880, just in case, this matters.

best regards,

Christoph

--
Christoph Höger

Technische Universität Berlin
Fakultät IV - Elektrotechnik und Informatik
Übersetzerbau und Programmiersprachen

Sekr. TEL12-2, Ernst-Reuter-Platz 7, 10587 Berlin

Tel.: +49 (30) 314-24890
E-Mail: [email protected]

Reply via email to