Opened 11 years ago
Closed 11 years ago
#2662 closed defect (fixed)
Handle self-referencing function calls
Reported by: | Martin Sjölund | Owned by: | somebody |
---|---|---|---|
Priority: | high | Milestone: | 1.9.1 |
Component: | Frontend | Version: | trunk |
Keywords: | Cc: | Per Östlund |
Description
The following goes into a stack overflow.
package Base partial function parent input Real a; algorithm g(a); end parent; end Base; function g extends Base.parent; end g; model M Real r = g(time,recurse=true); end M;
Change History (6)
follow-up: 2 comment:1 by , 11 years ago
comment:2 by , 11 years ago
Replying to sjoelund.se:
I guess I will have to have a look if you don't have time for it, Per.
Depends on how important it is to fix ;) If you want it fixed quickly it's probably best if you look at it yourself.
comment:3 by , 11 years ago
I have work-arounds I can use. The purpose is to write much cooler and optimised code in the bootstrapped compiler if it would work...
follow-up: 5 comment:4 by , 11 years ago
The following also stack overflows... +d=scodeInst says Error: Expected Base.parent to be a class, but found function instead.
package Base partial function parent input Real a; replaceable function self = parent; algorithm self(a); end parent; end Base; function g extends Base.parent; redeclare function self = g; end g; model M equation g(time); end M;
comment:5 by , 11 years ago
Replying to sjoelund.se:
The following also stack overflows... +d=scodeInst says Error: Expected Base.parent to be a class, but found function instead.
Fixed in r20099. scodeInst now gets a stack overflow instead, probably because the redeclare isn't handled.
I guess I will have to have a look if you don't have time for it, Per.