aboutsummaryrefslogtreecommitdiffstats
path: root/src/ortho
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2018-01-20 07:58:27 +0100
committerTristan Gingold <tgingold@free.fr>2018-01-20 14:25:54 +0100
commit2c1fcdea4def5a009aa031dfb37326a9db3b22dd (patch)
tree4872ceea1a476153c6dc44aba4a43be8d4c9105a /src/ortho
parent6df8dc1d3d5f23295c01ea8f565e4a048a279460 (diff)
downloadghdl-2c1fcdea4def5a009aa031dfb37326a9db3b22dd.tar.gz
ghdl-2c1fcdea4def5a009aa031dfb37326a9db3b22dd.tar.bz2
ghdl-2c1fcdea4def5a009aa031dfb37326a9db3b22dd.zip
mcode: assert identifiers don't have embedded NULL.
Diffstat (limited to 'src/ortho')
-rw-r--r--src/ortho/mcode/ortho_ident.adb5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ortho/mcode/ortho_ident.adb b/src/ortho/mcode/ortho_ident.adb
index 9b5a36ed0..c3990320d 100644
--- a/src/ortho/mcode/ortho_ident.adb
+++ b/src/ortho/mcode/ortho_ident.adb
@@ -37,9 +37,12 @@ package body Ortho_Ident is
begin
Start := Strs.Allocate (Str'Length + 1);
for I in Str'Range loop
+ -- Identifiers are NULL terminated, so they cannot have any
+ -- embedded NULL.
+ pragma Assert (Str (I) /= ASCII.NUL);
Strs.Table (Start + I - Str'First) := Str (I);
end loop;
- Strs.Table (Start + Str'Length) := ASCII.Nul;
+ Strs.Table (Start + Str'Length) := ASCII.NUL;
Ids.Append (Start);
return Ids.Last;
end Get_Identifier;