Opened 14 years ago

Last modified 14 years ago

#1438 closed defect (fixed)

Stack overflow for nested class extends

Reported by: Per Östlund Owned by: Per Östlund
Priority: critical Milestone:
Component: Version:
Keywords: Cc: Per Östlund, Per Östlund

Description

The following model results in a stack overflow:

class P1
  replaceable class C end C;
end P1;

class P2
  extends P1;
  redeclare class extends C end C;
end P2;

class P3
  extends P2;
  redeclare class extends C end C;

  C c;
end P3;

Change History (5)

comment:1 by Per Östlund, 14 years ago

This is used all over Media, so sooner or later you always run into this problem when fixing Media-problems. The cause is that instClassExtendsList2 will rename P1.C to C$parent, and create a new class for P2.C that extends C$parent. When instantiating P3 it will rename P2.C to P2.C$parent, so P2.C$parent will suddenly be extending itself, which causes an infinite loop in instExtendsList.

comment:2 by Adrian Pop, 14 years ago

I'll take a look at it ASAP.

comment:3 by Martin Sjölund, 14 years ago

I suggested using something like System.mo memory to generate unique IDs for these classes (reset at each inst'ion like hasExpandable, etc).

comment:4 by Adrian Pop, 14 years ago

Or we could use the current scope full path as the unique ID.

comment:5 by Per Östlund, 14 years ago

Fixed in r8132, see test case mofiles/ClassExtends5.

Note: See TracTickets for help on using tickets.