comp.lang.ada
 help / color / mirror / Atom feed
* GNAT Ada.Direct_IO bug
@ 2014-09-07 12:58 Dmitry A. Kazakov
  2014-09-07 14:28 ` Pascal Obry
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry A. Kazakov @ 2014-09-07 12:58 UTC (permalink / raw)


I have verified this under Windows 7 64-bit (NTFS) and 32-bit Linux and
Fedora. It seems that the implementation of GNAT Ada.Direct_IO is limited
to 2Gb file sizes regardless that the underlying OS has no such constraint.
Here is the test program:
------------------------------------------------------------
with Ada.Direct_IO;
with Ada.Text_IO;  use Ada.Text_IO;

procedure Test_DIO is
   type Block is array (1..1024) of Character;
   for Block'Size use 1024*8;
   package DIO is new Ada.Direct_IO (Block);
   File : DIO.File_Type;
   Data : Block := (others => ' ');
begin
   DIO.Create (File);
   for Giga in 1..2 loop
      for Mega in 1..1024 loop
         for Kilo in 1..1024 loop
	        DIO.Write (File, Data);
         end loop;
      end loop;
      Put_Line ("File size" & DIO.Count'Image (DIO.Size (File)) & "
Kbytes");
   end loop;
end Test_DIO;
------------------------------------------------------------- 
Under Windows [GNAT GPL gpl-2014 (20140405)] it silently wraps the file to
zero size. So the output looks like:

>test_dio.exe
File size 1048576 Kbytes
File size 0 Kbytes

32-bit Debian [4.9.1 (Debian 4.9.1-4)] exposes the same behavior as
Windows.

[64-bit Fedora and Debian work as expected]

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-07 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-07 12:58 GNAT Ada.Direct_IO bug Dmitry A. Kazakov
2014-09-07 14:28 ` Pascal Obry

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox