comp.lang.ada
 help / color / mirror / Atom feed
From: byhoe@greenlime.com (Adrian Hoe)
Subject: Stack overflow (or erroneous memory access)
Date: 7 Nov 2001 03:39:45 -0800
Date: 2001-11-07T11:39:45+00:00	[thread overview]
Message-ID: <9ff447f2.0111070339.17ae1674@posting.google.com> (raw)

I got an exception raised PROGRAM_ERROR : stack overflow (or erroneous
memory access) when I compiled the following code and executed it:

--------------------------------------------------------------
with Ada.Text_Io; use Ada.Text_Io;

procedure Test_Output is
   Buffer : String (1 .. 256);
   Len    : Natural;
   Output : File_Type;
begin
   Create (Output);

   Put_Line (Output, "Line #1");
   Put_Line (Output, "Line #2");
   Put_Line (Output, "Line #3");
   Put_Line (Output, "Line #4");
   Reset (Output, In_File);

   while not End_Of_File (Output) loop
      Get_Line (Output, Buffer, Len);

      if Len < Buffer'Length then
         Put_Line (Buffer (1 .. Len));
      else
         Put (Buffer);
      end if;
   end loop;

   Delete (Output);

end Test_Output;
---------------------------------------------------------------

The exception was raised at line 16: "while not End_Of_File (Output)
loop". I could not figure out the cause of this runtime error. Could
someone help?

I am using gnat-3.13p-7 (downloaded from gnuada.org for RH5.x) on
Caldera OpenLinux 2.3.

Thanks.



             reply	other threads:[~2001-11-07 11:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-07 11:39 Adrian Hoe [this message]
2001-11-07 14:05 ` Stack overflow (or erroneous memory access) James Rogers
2001-11-08  3:12   ` Adrian Hoe
replies disabled

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