On Tue, May 26, 2009 at 05:22:41PM +0200, Thomas Sailer wrote:
> in:
> procedure read (l: inout line; value: out string; good: out boolean)
>
> When l is (a pointer to) string(1 to 1) (eg. after write(l, a
> character)), and then I am trying to read a string of one character from
> l, I get a runtime error.
>
> The reason is that because l'left < l'right is false (l'ascending cannot
> be used, since ascending does not exist in VHDL-87), value := l (1
> downto 1) further down, which fails, because the array direction is to
> (and not downto).
Hi Thomas,
thank you for this bug report and the analysis. As you said, we can't avoid
the test. I have put the test at the same level as the other one (see
patch below).
Nice catch!
Tristan.
Index: textio_body.vhdl
===================================================================
--- textio_body.vhdl (revision 2000)
+++ textio_body.vhdl (working copy)
@@ -1304,10 +1304,18 @@
if len = 0 then
return;
end if;
- if l'left < l'right then
+ if l'left = l'right then
+ -- String of 1 character. We don't know the direction and therefore
+ -- can't use the code below which does a slice.
+ value := l.all;
+ deallocate (l);
+ l := new string'("");
+ elsif l'left < l'right then
+ -- Ascending.
value := l (l'left to l'left + len - 1);
trim (l, l'left + len);
else
+ -- Descending.
value := l (l'left downto l'left - len + 1);
trim (l, l'left - len);
end if;
_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss