﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
4224	Activated wrapFunctionCalls lets events fail with Cpp runtime	Rüdiger Franke	Lennart Ochel	"Commit [https://github.com/OpenModelica/OMCompiler/commit/e3ba94bad6d5f07b2b2149498b6d57083c0d3c71 ""wrapFunctionCalls is activated ...""] lets the event processing of the Cpp runtime fail.

See the following example:
{{{#!mo
model TrapezoidTest
  Modelica.Blocks.Sources.Trapezoid trapezoid(
    offset=1,
    period=10,
    amplitude=4,
    rising=1,
    width=4,
    falling=1,
    startTime=2)
    annotation (Placement(visible = true, transformation(extent = {{-50, 34}, {-30, 54}}, rotation = 0)));
equation
  annotation(experiment(StopTime=20));
end TrapezoidTest;
}}}

`trapezoid.y` stays at constant 1 throughout the simulation, instead of raising to 5 twice. The model `Modelica.Blocks.Sources.Trapezoid` contains the following when clause:
{{{#!mo
equation
  when integer((time - startTime)/period) > pre(count) then
    count = pre(count) + 1;
    T_start = time;
  end when;
}}}

There are two problems:

 1. The backend introduces a common subexpression for `integer((time - startTime)/period)`, even though it only appears once and the expression hardly justifies the overhead of a common subexpression.

 2. The Cpp runtime generates no event for the when clause with common subexpression."	defect	closed	critical	1.12.0	Backend	v1.12.0	fixed		Niklas Worschech Patrick Täuber
