This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/13053] New: GNAT BUG DETECTED


+===========================GNAT BUG DETECTED==============================+
| 3.3.2 20031022 (Red Hat Linux 3.3.2-1) (i386-redhat-linux-gnu) GCC error:|
| dans expand_call, à calls.c:3112                                        |
| Error detected at aws-os_lib.adb:145:10                                  |
| Please submit a bug report; see http://gcc.gnu.org/bugs.html.            |
| Include the entire contents of this bug box in the report.               |
| Include the exact gcc or gnatmake command that you entered.              |
| Also include sources listed below in gnatchop format                     |
| concatenated together with no headers between files.                     |
+==========================================================================+

gnatmake -u -q -O2 -gnatn -gnatwcfipru -gnaty3abcefhiklmnoprst

-- -------------------------------------------------
with Ada.Calendar;
with Ada.Streams;

package AWS.OS_Lib is

   No_Such_File : exception;

   function Is_Regular_File (Filename : in String) return Boolean;
   pragma Inline (Is_Regular_File);
   --  Returns True if Filename is a regular file and is readable.

   function Is_Directory (Filename : in String) return Boolean;
   pragma Inline (Is_Directory);
   --  Returns True if Filename is a directory.

   function File_Size (Filename : in String)
      return Ada.Streams.Stream_Element_Offset;
   pragma Inline (File_Size);
   --  Returns Filename's size in bytes.

   function File_Timestamp (Filename : in String) return Ada.Calendar.Time;
   pragma Inline (File_Timestamp);
   --  Get the time for last modification to a file in UTC/GMT.

   function GMT_Clock return Ada.Calendar.Time;
   pragma Inline (GMT_Clock);
   --  Returns current UTC/GMT time.

end AWS.OS_Lib;
-- -------------------------------------------------

with GNAT.OS_Lib;

package body AWS.OS_Lib is

   function OS_Time_To_Calendar_Time (UTC : in GNAT.OS_Lib.OS_Time)
     return Ada.Calendar.Time;
   --  Returns a Calendar.Time from an OS_Time variable.

   Max_Path : constant Integer;
   pragma Import (C, Max_Path, "max_path_len");
   --  Maximum full pathname supported by the OS including a terminating NUL
   --  character.
   --  ??? We have to check length of path for avoid GNAT bug with too long
   --  path in versions older than 3.17 and 5.02.

   ---------------
   -- File_Size --
   ---------------

   function File_Size (Filename : in String)
     return Ada.Streams.Stream_Element_Offset
   is
      use GNAT.OS_Lib;

      Name   : String := Filename & ASCII.NUL;
      FD     : File_Descriptor;
      Length : Ada.Streams.Stream_Element_Offset := 0;
   begin
      FD := Open_Read (Name'Address, Binary);
      if FD /= Invalid_FD then
         Length := Ada.Streams.Stream_Element_Offset (File_Length (FD));
         Close (FD);
         return Length;
      end if;
      raise No_Such_File;
   end File_Size;

   --------------------
   -- File_Timestamp --
   --------------------

   function File_Timestamp (Filename : in String) return Ada.Calendar.Time is
   begin
      return OS_Time_To_Calendar_Time (GNAT.OS_Lib.File_Time_Stamp (Filename));
   exception
      when others =>
         raise No_Such_File;
   end File_Timestamp;

   ---------------
   -- GMT_Clock --
   ---------------

   function GMT_Clock return Ada.Calendar.Time is
      type OS_Time_A is access all GNAT.OS_Lib.OS_Time;

      function C_Time (Time : OS_Time_A) return GNAT.OS_Lib.OS_Time;
      pragma Import (C, C_Time, "time");

   begin
      return OS_Time_To_Calendar_Time (C_Time (null));
   end GMT_Clock;

   ------------------
   -- Is_Directory --
   ------------------

   function Is_Directory (Filename : in String) return Boolean is
   begin
      --  ??? We have to check length of path for avoid GNAT bug with too long
      --  path in versions older than 3.17 and 5.02.
      --  The comparition operator is "<" because Max_Path is length of path
      --  including terminating NUL. So Ada string length should be shorter for
      --  one symbol.

      return Filename'Length < Max_Path
             and then GNAT.OS_Lib.Is_Directory (Filename);
   end Is_Directory;

   ---------------------
   -- Is_Regular_File --
   ---------------------

   function Is_Regular_File (Filename : in String) return Boolean is
   begin
      --  ??? We have to check length of path for avoid GNAT bug with too long
      --  path in versions older than 3.17 and 5.02.

      return Filename'Length < Max_Path
             and then GNAT.OS_Lib.Is_Regular_File (Filename);
   end Is_Regular_File;

   ------------------------------
   -- OS_Time_To_Calendar_Time --
   ------------------------------

   function OS_Time_To_Calendar_Time (UTC : in GNAT.OS_Lib.OS_Time)
      return Ada.Calendar.Time
   is
      Year   : Integer;
      Month  : Integer;
      Day    : Integer;
      Hour   : Integer;
      Minute : Integer;
      Second : Integer;
   begin
      GNAT.OS_Lib.GM_Split (UTC, Year, Month, Day, Hour, Minute, Second);
      return Ada.Calendar.Time_Of
        (Year, Month, Day,
         Duration (Hour   * 3600 + Minute * 60 + Second));
   end OS_Time_To_Calendar_Time;

end AWS.OS_Lib;

---------------------------------------------------------------------------
package AWS is

   pragma Pure;

   Version      : constant String := "1.4";

   HTTP_Version : constant String := "HTTP/1.1";

end AWS;

-- 
           Summary: GNAT BUG DETECTED
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jframeau at cyberdeck dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: 20031022
  GCC host triplet: Red Hat Linux 3.3.2-1
GCC target triplet: 3.3.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13053


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]