Opened 14 years ago

Last modified 14 years ago

#1360 closed defect (fixed)

Rewrite assignment of function String outputs

Reported by: sjoelund.se Owned by: sjoelund.se
Priority: high Milestone:
Component: Version:
Keywords: Cc: sjoelund.se, sjoelund.se

Description

Things that are stored in the memory pool are not handled correctly on function return:

{{{package P

function weirdStrStuff

input String str;
output String os1;
output String os2;

algorithm

os1 := "os1";
os2 := "os2";

end weirdStrStuff;

function weirdStrStuff1

input String str;
output String os;
String os1,os2;

algorithm

(os1,os2) := weirdStrStuff(str);
os := "overwritethecharpoolhere";
os := os1+os2;

end weirdStrStuff1;

constant String str1 = weirdStrStuff1("abc");

end P;}}}

str1 = "overwritethecharpoolhere" if we enable the memory pool

Currently, we malloc() all strings instead of using the string pool because of this bug.

Change History (0)

Note: See TracTickets for help on using tickets.