Opened 3 years ago

Last modified 2 years ago

#5336 new defect

Range expression problems

Reported by: Jonathan Kämpe Owned by: Jonathan Kämpe
Priority: major Milestone:
Component: Modelica/FrontEnd Version: trunk
Keywords: Cc:

Description

There seems to be some issues with range expressions for unknown size and non-numeric type

function f
    input Boolean b;
    output Boolean y[:] = false:b;
algorithm
end f;

Boolean[:] b = f(true);
function f
    input Boolean b;
    output Boolean y[:] = b:b;
algorithm
end f;

Boolean[:] b = f(true);

Change History (1)

comment:1 Changed 2 years ago by Jonathan Kämpe

Flattened:

 function Test.Test1.f
  input Boolean b;
  output Boolean[:] y;
 algorithm
  init y as Boolean[max(integer((if b then 2 else 1) - 1) + 1, 0)];
  y := false:b;
  return;
 end Test.Test1.f;

Scalarized

 function Test.Test1.f
  input Boolean b;
  output Boolean[:] y;
 algorithm
  init y as Boolean[max(integer((if b then 2 else 1) - 1) + 1, 0)];
  for i1 in 1:max(integer((if b then 2 else 1) - (if false then 2 else 1)) + 1, 0) loop
   y[i1] := false + (i1 - 1);
  end for;
  return;
 end Test.Test1.f;
Note: See TracTickets for help on using tickets.