Opened 11 years ago

Closed 10 years ago

#2699 closed defect (fixed)

wrong instantiation for algorithms with loops and array indexing

Reported by: Lennart Ochel Owned by: Mahder Alemseged Gebremedhin
Priority: high Milestone: 1.9.2
Component: Frontend Version: trunk
Keywords: Cc: Adrian Pop, Martin Sjölund

Description

Please, check the following model:

model test
  record foo
    goo f[2];
  end foo;

  record goo
    Real g;
  end goo;

    foo f;
algorithm
  for i in 1:2 loop
      f.f[i].g := time;
    end for;
end test;

Instantiation produces the following output:

function test.foo \"Automatically generated record constructor for test.foo\"
  input test.goo[2] f;
  output foo res;
end test.foo;

function test.goo \"Automatically generated record constructor for test.goo\"
  input Real g;
  output goo res;
end test.goo;

class test
  Real f.f[1].g;
  Real f.f[2].g;
algorithm
  for i in 1:2 loop
    f.f.g[i] := time;
  end for;
end test;

Change History (9)

comment:1 by Lennart Ochel, 11 years ago

Such models throw the following back end error message:

Error: Model is structurally singular, error found sorting equations 
 1: algorithm
  for i in 1:2 loop
    f.f.g[i] := time;
  end for;
;
 for variables 
 f.f[2].g(1), f.f[1].g(2)
Error: Internal error Transformation Module PFPlusExt index Reduction Method Pantelides failed!

comment:2 by Lennart Ochel, 11 years ago

Cc: Adrian Pop Martin Sjölund added

comment:3 by Per Östlund, 11 years ago

It's because of this: #2688.

comment:4 by Lennart Ochel, 11 years ago

Okay, in this case we can probably close this as duplicate. Is anyone working on #2688?

in reply to:  4 comment:5 by Per Östlund, 11 years ago

Replying to lochel:

Okay, in this case we can probably close this as duplicate. Is anyone working on #2688?

Not that I know of.

comment:6 by Adrian Pop, 11 years ago

I think Mahder is partially working on #2668 as he's trying to change the handling of crefs to be uniform in the compiler and code generation.

comment:7 by Adrian Pop, 11 years ago

Owner: changed from somebody to Mahder Alemseged Gebremedhin
Status: newassigned

comment:8 by Martin Sjölund, 10 years ago

Milestone: 1.9.11.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:9 by Mahder Alemseged Gebremedhin, 10 years ago

Resolution: fixed
Status: assignedclosed

Fixed in r24667

Note: See TracTickets for help on using tickets.