Skip to content

Commit cbdd59d

Browse files
sjoelundOpenModelica-Hudson
authored andcommitted
Add stack overflow test
1 parent badbf5c commit cbdd59d

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

flattening/modelica/algorithms-functions/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ MRFcall.mo \
9090
MultFuncCall.mo \
9191
RecursiveCallExtends.mo \
9292
RecursiveFunctionCall.mo \
93-
SumForLoop.mo \
93+
StackOverflowTest.mos \
9494
Summation.mo \
9595
SumSeriesWhile.mo \
9696
SumVectorForIf.mo \
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// status: correct
2+
3+
loadString("model StackOverflowTest
4+
function f
5+
output Real r = 2;
6+
algorithm
7+
f();
8+
print(\"Can't get here, can you?\n\");
9+
end f;
10+
constant Real r = f();
11+
end StackOverflowTest;");
12+
getErrorString();
13+
instantiateModel(StackOverflowTest);
14+
getErrorString();
15+
16+
// Result:
17+
// true
18+
// ""
19+
// "function StackOverflowTest.f
20+
// output Real r = 2.0;
21+
// algorithm
22+
// fail();
23+
// print(\"Can't get here, can you?
24+
// \");
25+
// end StackOverflowTest.f;
26+
//
27+
// class StackOverflowTest
28+
// constant Real r = fail();
29+
// end StackOverflowTest;
30+
// "
31+
// "[Script/CevalScript.mo:0:0-0:0:writable] Error: Internal error Stack overflow when evaluating function call: StackOverflowTest.f()...
32+
// [bt] [Symbols are not generated when running the test suite]
33+
// "
34+
// endResult

flattening/modelica/redeclare/ComparePSD.mo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// name: ComparePSD.mo [BUG: #2739]
22
// keywords: redeclare function
3+
// cflags: -d=nogen
34
// status: correct
45
//
56
// Checks that it's possible to uniquely modify packages in different components having the same type

simulation/modelica/arrays/gc.mos

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ simulate(gctest, numberOfIntervals=2); getErrorString();
7373
// String str[15];
7474
// String s;
7575
// equation
76-
// str = Modelica.Utilities.Streams.readFile(\"gc.mo\");
76+
// str = {\"model gctest\", \" String str[:] = Modelica.Utilities.Streams.readFile(\\\"gc.mo\\\"); // Reads itself\", \" String s;\", \"algorithm\", \" for i in 1:1000 loop\", \" // print(String(i) + \\\"\\\\n\\\");\", \" s := String(i) + \\\"\\\\n\\\";\", \" if noEvent(i == 1000) then print(s); end if;\", \" for j in 1:size(str, 1) loop\", \" // print(str[j] + \\\"\\\\n\\\");\", \" s := str[j] + \\\"\\\\n\\\";\", \" if noEvent(i == 1000) then print(s); end if;\", \" end for;\", \" end for;\", \"end gctest;\"};
7777
// algorithm
7878
// for i in 1:1000 loop
7979
// s := String(i, 0, true) + \"

0 commit comments

Comments
 (0)