Opened 3 years ago

Last modified 3 years ago

#5197 new defect

Evaluation of unused if branch for function arguments

Reported by: Zimon Kuhs Owned by: Jesper Mattsson
Priority: major Milestone:
Component: Modelica/FrontEnd Version: trunk
Keywords: Cc:

Description

Type check errors are reported for function arguments in unused if-branches. In the model below, an error is reported for r = a2 even though size(a1, 1) == 1 is true.

model M
    record R
        Real[1]  r;
    end R;

        Real a1[1] = { 0 };
        Real a2[2] = { 0, 0 };
        R   rec;
    algorithm
        rec := if size(a1, 1) == 1 then R(r = a1) else R(r = a2);
end M;

Change History (3)

comment:1 Changed 3 years ago by Zimon Kuhs

changeset:9406

  • Function arguments in unused if-branches are no longer evaluated

comment:2 Changed 3 years ago by Zimon Kuhs

changeset:9413

Reverting r9406 since it broke some tests.

Last edited 3 years ago by Zimon Kuhs (previous) (diff)

comment:3 Changed 3 years ago by Zimon Kuhs

changeset:9419

Function arguments in unused if-branches are no longer evaluated (r9406 with repositioning of lockbranch).

Note: See TracTickets for help on using tickets.