Opened 2 years ago

#5427 assigned defect

Naming break temporaries

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

Description

The naming of temporaries for break statements is wierd. In the following model i would expect them to have either global scope (naming it "temp_1") or local scope (naming it "m.temp_1"). The current implementation checks for name collisions in the global scope but gives it a name based of the local scope and the name of the top level class ("m.Test1.temp_1"). This could lead to name collisions. In this particular example the last if statement is generated with an incomplete name ("Test1.temp_1") which leads to an exception.

    model Test1
        model M
            Real x;
        algorithm
            for i in 1:3 loop
                if i > 2 then
                    break;
                end if;
                x := i;
            end for;
        end M;
        
        M m;
    end Test1;
fclass Test.Test1
 discrete Boolean m.Test1.temp_1;
 Real m.x;
algorithm
 m.Test1.temp_1 := true;
 if m.Test1.temp_1 then
  m.x := 1;
 end if;
 if m.Test1.temp_1 then
  m.x := 2;
 end if;
 if m.Test1.temp_1 then
  m.Test1.temp_1 := false;
  if Test1.temp_1 then
   m.x := 3;
  end if;
 end if;
end Test.Test1;

Change History (0)

Note: See TracTickets for help on using tickets.