aboutsummaryrefslogtreecommitdiffstats
path: root/libraries/std/textio_body.vhdl
diff options
context:
space:
mode:
authorgingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7>2009-06-08 02:02:20 +0000
committergingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7>2009-06-08 02:02:20 +0000
commit52741663129845a55bf7beacd042e42932278839 (patch)
treeec0da0d2d77a2dab6b494a8417d659eb9a737fda /libraries/std/textio_body.vhdl
parentdb0dacf3b4a07f26c317d7cda0c6f8882e511f88 (diff)
downloadghdl-52741663129845a55bf7beacd042e42932278839.tar.gz
ghdl-52741663129845a55bf7beacd042e42932278839.tar.bz2
ghdl-52741663129845a55bf7beacd042e42932278839.zip
Fix bug #13574, std.textio.read (string) bug
Diffstat (limited to 'libraries/std/textio_body.vhdl')
-rw-r--r--libraries/std/textio_body.vhdl8
1 files changed, 8 insertions, 0 deletions
diff --git a/libraries/std/textio_body.vhdl b/libraries/std/textio_body.vhdl
index 1809adfc3..db0e7fe06 100644
--- a/libraries/std/textio_body.vhdl
+++ b/libraries/std/textio_body.vhdl
@@ -1305,9 +1305,17 @@ package body textio is
return;
end if;
if l'left < l'right then
+ -- Ascending (expected common case).
value := l (l'left to l'left + len - 1);
trim (l, l'left + len);
+ elsif 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'("");
else
+ -- Descending.
value := l (l'left downto l'left - len + 1);
trim (l, l'left - len);
end if;