Hi Tristan,
it seems i found and solved a bug:
GRT's "File_Close" procedure doesn't check if the file is stdout or
stdin before closing it.

testbench that show the bug and patch are in attachement

--- translate/grt/grt-files.adb	2008-12-18 19:20:16.000000000 +0100
+++ /home/steissier/grt-files.adb	2008-12-18 19:21:30.000000000 +0100
@@ -409,8 +409,10 @@
       if Stream = NULL_Stream then
          return;
       end if;
-      if fclose (Stream) /= 0 then
-         Internal_Error ("file_close: fclose error");
+      if Stream/=stdout and then Stream/=stdin then
+         if fclose (Stream) /= 0 then
+            Internal_Error ("file_close: fclose error");
+         end if;
       end if;
       Files_Table.Table (File).Stream := NULL_Stream;
    end File_Close;
use std.textio.all;

entity tb is
end entity;

architecture test of tb is
	procedure crash is
		file std_out: text is out "STD_OUTPUT";
		variable ligne:line;
	begin
		write(ligne,string'("test"));
		writeline(std_out,ligne);
	end;
begin
	test: process
	begin
		crash;
	end process;
end architecture;






_______________________________________________
Ghdl-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/ghdl-discuss

Reply via email to