comp.lang.ada
 help / color / mirror / Atom feed
* Ada strangeness or bug in Gnat?
@ 1996-11-06  0:00 Henry Ware
  1996-11-05  0:00 ` Vincent Celier
  0 siblings, 1 reply; 7+ messages in thread
From: Henry Ware @ 1996-11-06  0:00 UTC (permalink / raw)



Hi,

Heres some sample code:

---Cut Here
with Ada.Text_Io, Ada.Integer_text_io;
use Ada.Text_Io, Ada.Integer_text_io;

procedure foo3 is 
   
   type Int2_Array is array (1..2) of Integer;

   -- Return the same values sorted in ascending order
   procedure Sort_Int2 (Unsorted : in Int2_array; Sorted : out Int2_array) is
      begin
	 if ( Unsorted(1) < Unsorted(2) ) then
	    Sorted(1):=Unsorted(1);
	    Sorted(2):=Unsorted(2);
	 else 
	    Sorted(1):=Unsorted(2);
	    Sorted(2):=Unsorted(1);
	 end if;
      end Sort_Int2;

   Z: Int2_array;
   
begin
   Z(1):=2;
   Z(2):=1;

   -- This should(?) act like a swap 
   Sort_Int2(Z(1..2),Z(1..2));
   -- ...but actually returns 1,1
   Put(Z(1));
   New_Line;
   Put(Z(2));
   New_Line;
end foo3;
--Cut Here

The same code works as expected if arrays are not used: ie the
procedure takes 4 arguments.

Is this correct?  We are using Gnat3.03.

Thanks,
--
Henry Ware			hware@cs.wvu.edu
% rm file
rm: remove file? y
rm: you realize that you'll never get it back? y
rm: wouldn't you rather keep it? n
rm: ok, now let me get this straight.  you voted for clinton last election
    and you want me to trust your judgment on deleting this file.  personally,
    i don't feel you're qualified for a decision of this caliber.  how about
    we run xeyes instead? n
rm: are you absolutely positively sure that you want to remove this file? y
rm: hesitation detected in reply. file not removed.




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~1996-11-07  0:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-11-06  0:00 Ada strangeness or bug in Gnat? Henry Ware
1996-11-05  0:00 ` Vincent Celier
1996-11-06  0:00   ` Joerg Rodemann
1996-11-06  0:00     ` Vincent Celier
1996-11-06  0:00   ` Ronald Cole
1996-11-06  0:00     ` Robert Dewar
1996-11-07  0:00   ` Peter Amey

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