﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4498	External object initialization dependencies	Bernhard Thiele	Lennart Ochel	"I have a model that requires that two external objects are constructed in the correct sequence since one external object (`ep1`) is an argument to the constructor of the second external object (`ep2`). The idea is sketched below, the complete example is attached to this ticket.

{{{
#!modelica
  model Test_EPInit
    EP1 ep1 = EP1();
    EP2 ep2 = EP2(ep1);
  equation
    when time > 0.1 then
      EP1_Print(ep1);
      EP2_Print(ep2);
    end when;
    annotation (Icon(coordinateSystem(preserveAspectRatio=false)), Diagram(
          coordinateSystem(preserveAspectRatio=false)));
  end Test_EPInit;
}}}

Simulating this test model with a nightly build on a 64-bit Linux with

{{{
#!modelica
loadFile(""EPInit.mo"");
simulate(EPInit.Test_EPInit, startTime=0, stopTime=1); getErrorString();
}}}

results in a segmentation fault error.

{{{
...
    messages = ""Simulation execution failed for model: EPInit.Test_EPInit
stdout            | info    | Entering EP1_Constructor()
stdout            | info    | The initialization finished successfully without homotopy method.
stdout            | info    | Entering EP2_Print()
stdout            | info    | EP2_Print: invalid pointer

Limited backtrace at point of segmentation fault
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10330)[0x7f3390c09330]
/home/bernhard/data/workspace/OMFMISimulator/testsuite/OMSimulatorModelica/EPInit.Test_EPInit(EP2_Print+0x44)[0x407404]
...
}}}

From the outputs it appears to me that the constructor of the second external object is not called at all."	defect	closed	high	1.13.0	Initialization		fixed		Patrick Täuber
