This is the mail archive of the gcc-patches@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]

Fix problem with late insns in sibcall


This fixes the following Ada test case on x86.  I suspect this may be a bit
"heavy handed" and hope that people who know sibcall better than Olivier
and I can come up with a "tighter" fix.

Tested on i686-pc-linux-gnu.

with Points; use Points;

procedure P is 
   Point : Point_T;
begin

   Point.X := 1;

   Shift (Point);

   if Point.X /= 2 then
      raise Program_Error;
   end if;
end;
package body Points is

   procedure
     Shift (Point : in out Point_T)
   is
      procedure
        Shift (Value : in out Natural )
      is
      begin
         Value := Value + 1;
      end;
   begin
      Shift (Point.X);
   end;

end Points;
package Points is

  type Point_T is
    record
       X, Y : Natural;
       Pad1 : Integer;
       Pad2 : Integer;
    end record;

  procedure Shift (Point : in out Point_T);
end Points;

Mon Nov 18 09:43:38 2002  Olivier Hainque <hainque@act-europe.fr>

	* calls.c (expand_call): When modes of target and valreg match,	force
	sibcall failure when target is a MEM.

*** gcc/calls.c	22 Apr 2003 05:44:04 -0000	1.270
--- gcc/calls.c	22 Apr 2003 23:01:45 -0000
*************** expand_call (exp, target, ignore)
*** 3280,3283 ****
--- 3280,3289 ----
  	     except when function inlining is being done.  */
  	  emit_move_insn (target, valreg);
+ 
+ 	  /* If we are setting a MEM, this code must be executed.  Since it is
+ 	     emitted after the call insn, sibcall optimization cannot be
+ 	     performed in that case.  */
+ 	  if (GET_CODE (target) == MEM)
+ 	    sibcall_failure = 1;
  	}
        else if (TYPE_MODE (TREE_TYPE (exp)) == BLKmode)


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