Page 1 of 1
issue-#128 Assignment of named empty string to SHORTCHARs
Posted: Tue Sep 06, 2016 3:31 pm
by Josef Templ
I have noticed that assignment of a named empty string constant to a variable of type
ARRAY OF SHORTCHAR does not work. Also in 1.6.
For the issue see
http://redmine.blackboxframework.org/issues/128.
Here is a test program that fails:
Code: Select all
MODULE Test;
CONST NamedEmptyStr = "";
PROCEDURE Do*;
VAR s: ARRAY 30 OF SHORTCHAR;
BEGIN
s := NamedEmptyStr;
ASSERT(s[0] = 0X, 99);
END Do;
END Test.
This reminds me of Robert's question: Will it ever end?
- Josef
Re: issue-#128 Assignment of named empty string to SHORTCHAR
Posted: Wed Sep 07, 2016 4:00 am
by Josef Templ
Here is the diff of my proposal for a fix:
http://redmine.blackboxframework.org/pr ... c73e8746c7
This fix is in the front-end where there is an optimization for an assignment of an empty stirng.
It is converted into s[0] := 0X and the conversion had a bug. It did not clear the original constant object of the string.
Therefore it was used by the code generator instead of the value 0.
- Josef
Re: issue-#128 Assignment of named empty string to SHORTCHAR
Posted: Wed Sep 07, 2016 8:27 am
by luowy
Josef Templ wrote:Here is the diff of my proposal for a fix:
http://redmine.blackboxframework.org/pr ... c73e8746c7
This fix is in the front-end where there is an optimization for an assignment of an empty stirng.
It is converted into s[0] := 0X and the conversion had a bug. It did not clear the original constant object of the string.
Therefore it was used by the code generator instead of the value 0.
- Josef
yes,very well.
Re: issue-#128 Assignment of named empty string to SHORTCHAR
Posted: Fri Sep 09, 2016 12:55 pm
by Josef Templ
This issue is ready for voting, I think.
- Josef
Re: issue-#128 Assignment of named empty string to SHORTCHAR
Posted: Fri Sep 09, 2016 3:58 pm
by Robert
Josef Templ wrote:This reminds me of Robert's question: Will it ever end?
This reminds me of Chris' answer: "No"