comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: GNAT Ada.Direct_IO bug
Date: Sun, 7 Sep 2014 14:58:54 +0200
Date: 2014-09-07T14:58:54+02:00	[thread overview]
Message-ID: <9tf9x3eahm6h$.rh1bpbijiyjl.dlg@40tude.net> (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


             reply	other threads:[~2014-09-07 12:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-07 12:58 Dmitry A. Kazakov [this message]
2014-09-07 14:28 ` GNAT Ada.Direct_IO bug Pascal Obry
replies disabled

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