OSDN Git Service

Fix aliasing bug that also caused memory usage problems.
[pf3gnuchains/gcc-fork.git] / gcc / ada / g-table.ads
index 7392582..daa8e2b 100644 (file)
@@ -6,8 +6,7 @@
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---                                                                          --
---            Copyright (C) 1998-2001 Ada Core Technologies, Inc.           --
+--            Copyright (C) 1998-2003 Ada Core Technologies, Inc.           --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -27,7 +26,8 @@
 -- however invalidate  any other reasons why  the executable file  might be --
 -- covered by the  GNU Public License.                                      --
 --                                                                          --
--- GNAT is maintained by Ada Core Technologies Inc (http://www.gnat.com).   --
+-- GNAT was originally developed  by the GNAT team at  New York University. --
+-- Extensive contributions were provided by Ada Core Technologies Inc.      --
 --                                                                          --
 ------------------------------------------------------------------------------
 
@@ -90,6 +90,19 @@ pragma Elaborate_Body (Table);
    --  restrict the use of table for discriminated types. If it is necessary
    --  to take the access of a table element, use Unrestricted_Access.
 
+   --  WARNING: On HPPA, the virtual addressing approach used in this unit
+   --  is incompatible with the indexing instructions on the HPPA. So when
+   --  using this unit, compile your application with -mdisable-indexing.
+
+   --  WARNING: If the table is reallocated, then the address of all its
+   --  components will change. So do not capture the address of an element
+   --  and then use the address later after the table may be reallocated.
+   --  One tricky case of this is passing an element of the table to a
+   --  subprogram by reference where the table gets reallocated during
+   --  the execution of the subprogram. The best rule to follow is never
+   --  to pass a table element as a parameter except for the case of IN
+   --  mode parameters with scalar values.
+
    type Table_Type is
      array (Table_Index_Type range <>) of Table_Component_Type;
 
@@ -155,11 +168,11 @@ pragma Elaborate_Body (Table);
 
    procedure Increment_Last;
    pragma Inline (Increment_Last);
-   --  Adds 1 to Last (same as Set_Last (Last + 1).
+   --  Adds 1 to Last (same as Set_Last (Last + 1)
 
    procedure Decrement_Last;
    pragma Inline (Decrement_Last);
-   --  Subtracts 1 from Last (same as Set_Last (Last - 1).
+   --  Subtracts 1 from Last (same as Set_Last (Last - 1)
 
    procedure Append (New_Val : Table_Component_Type);
    pragma Inline (Append);