Opened 2 years ago

#5512 new defect

Function inlining ignores noEvent() around function

Reported by: Jesper Mattsson Owned by: jsten
Priority: major Milestone:
Component: Modelica/MiddleEnd Version: trunk
Keywords: Cc:


Function inlining does not take whether the function call was within noEvent() or not into regard. This makes event-generating expressions in the arguments end up outside of noEvent().

This probably also applies to other cases when we generate temporaries.

It might be harder to solve for temporaries of discrete types - if we just add noEvent() to the binding expression, then the value won't be updated.

Example, where the if expressions end up outside the noEvent():

model Test
    function func
        input Real x;
        input Real y;
        output Real z;
        z := x * y;
        end func;
    Real a = time * 2;
    Real b = time * 3;
    Real c = time * 4;
    Real d = time * 5;
    Real e = time * 6;
    Real f = time * 7;
    Real h = noEvent(func(if a > 4 then b else c, if d < 3 then e else f));
end Test;

Change History (0)

Note: See TracTickets for help on using tickets.