------- Additional Comments From baldrick at free dot fr  2005-07-19 12:22 
-------
The same problem is still present if the array bounds are not static. 
The following test case gives 
 
$ ./u 
Expected  20, found  30 
Expected  30, found  40 
Expected  40, found -1076635688 
 
with Ada.Text_IO; use Ada.Text_IO; 
procedure U is 
   type Index_Type is range 0 .. 4; -- does not fail if lower bound is 1 
 
   type Unconstrained_Array_Type is array (Index_Type range <>) of Integer; 
 
   function Two return Index_Type is 
   begin 
      return 2; 
   end; 
 
   function Four return Index_Type is 
   begin 
      return 4; 
   end; 
 
   subtype Array_Type is Unconstrained_Array_Type (Two .. Four); 
 
   type Target_Type is array (1 .. 1) of Array_Type; 
 
   Target : Target_Type; 
 
   procedure Check (Index : Index_Type; Value : Integer) is 
   begin 
      if Target (1) (Index) /= Value then 
         Put_Line ("Expected " & Integer'Image (Value) & ", found " & 
Integer'Image (Target (1) (Index))); 
      end if; 
   end Check; 
begin 
   Target := (1 => (1 => 20, 2 => 30, 3 => 40)); -- the assignment requires 
sliding 
 
   Check (2, 20); 
   Check (3, 30); 
   Check (4, 40); 
end; 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


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

Reply via email to