Is there anyone out there who might have a SPARC environment with Ada
support who could run the attached Ada testcase on a version of gcc
patched with the attached patch?  I'd like to verify whether the test
behaves correctly when compiled at -O0, -O1, and -O2.  The expected
(correct) behavior is the following output:

a_value= 10 b_value= 20

Some context of what I'm trying to accomplish can be seen by looking at
the thread starting here:

  http://gcc.gnu.org/ml/gcc/2006-08/msg00389.html


My utmost gratitude to anyone who can help!

- Josh
Index: gcc/calls.c
===================================================================
--- gcc/calls.c (revision 116236)
+++ gcc/calls.c (working copy)
@@ -1985,9 +1985,8 @@
            /* For variable-sized objects, we must be called with a target
               specified.  If we were to allocate space on the stack here,
               we would have no way of knowing when to free it.  */
-           rtx d = assign_temp (TREE_TYPE (exp), 1, 1, 1);
+           rtx d = assign_temp (TREE_TYPE (exp), 0, 1, 1);
 
-           mark_temp_addr_taken (d);
            structure_value_addr = XEXP (d, 0);
            target = 0;
          }
with Ada.Text_Io;

procedure Test_Func is
   type A_Int is new Integer range 1..10;
   type B_Int is new Integer range 11..20;
   type A_Array is array(1..5) of A_Int;
   type B_Array is array(1..5) of B_Int;

   procedure  Print_Values (A_Value  : in A_Int;
                            B_Value : in B_Int)  is
   begin
      Ada.Text_Io.Put_Line("a_value="  & Integer'Image(Integer(A_Value)) &
                           " b_value=" & Integer'Image(Integer(B_Value)));
   end Print_Values;

   function Get_A return A_Array is
      A : A_Array := (others => 10);
   begin
      return A;
   end Get_A;

   function Get_B return B_Array is
      B : B_Array := (others => 20);
   begin
      return B;
   end Get_B;

   J : Natural := 3;
begin

   Print_Values
     (A_Value =>Get_A(J), B_Value =>Get_B(J));
end Test_Func;

Reply via email to