summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--testsuite/gna/bug16144/adder.vhdl2
-rwxr-xr-xtestsuite/gna/bug16144/testsuite.sh7
-rw-r--r--translate/ghdldrv/ghdlprint.adb8
3 files changed, 16 insertions, 1 deletions
diff --git a/testsuite/gna/bug16144/adder.vhdl b/testsuite/gna/bug16144/adder.vhdl
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/testsuite/gna/bug16144/adder.vhdl
@@ -0,0 +1,2 @@
+
+
diff --git a/testsuite/gna/bug16144/testsuite.sh b/testsuite/gna/bug16144/testsuite.sh
new file mode 100755
index 0000000..7a261ed
--- /dev/null
+++ b/testsuite/gna/bug16144/testsuite.sh
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+. ../../testenv.sh
+
+$GHDL --lines adder.vhdl
+
+echo "Test successful"
diff --git a/translate/ghdldrv/ghdlprint.adb b/translate/ghdldrv/ghdlprint.adb
index dedc1eb..dfe44ff 100644
--- a/translate/ghdldrv/ghdlprint.adb
+++ b/translate/ghdldrv/ghdlprint.adb
@@ -868,6 +868,7 @@ package body Ghdlprint is
begin
Local_Id := Get_Identifier ("");
for I in Args'Range loop
+ -- Load the file.
Id := Get_Identifier (Args (I).all);
Fe := Files_Map.Load_Source_File (Local_Id, Id);
if Fe = No_Source_File_Entry then
@@ -875,6 +876,8 @@ package body Ghdlprint is
raise Compile_Error;
end if;
Set_File (Fe);
+
+ -- Scan the content, to compute the number of lines.
loop
Scan.Scan;
exit when Current_Token = Tok_Eof;
@@ -925,7 +928,10 @@ package body Ghdlprint is
end loop;
-- Disp line.
- Put (String (Buf (Ptr .. Eptr - 1)));
+ if Eptr > Ptr then
+ -- Avoid constraint error on conversion of nul array.
+ Put (String (Buf (Ptr .. Eptr - 1)));
+ end if;
New_Line;
end loop;
end loop;