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]

std_expand_builtin_va_start should take parm boundaries into account


I'm checking this in, pre-approved by Richard Henderson.

Index: gcc/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* builtins.c (std_expand_builtin_va_start): Take PARM_BOUNDARY
	into account.

Index: gcc/builtins.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/builtins.c,v
retrieving revision 1.66
diff -u -p -r1.66 builtins.c
--- gcc/builtins.c 2000/11/09 09:07:42 1.66
+++ gcc/builtins.c 2000/11/11 05:59:07
@@ -2250,14 +2250,18 @@ stabilize_va_list (valist, needs_lvalue)
    the variable.  */
 void
 std_expand_builtin_va_start (stdarg_p, valist, nextarg)
-     int stdarg_p ATTRIBUTE_UNUSED;
+     int stdarg_p;
      tree valist;
      rtx nextarg;
 {
   tree t;
 
-  if (!stdarg_p)
-    nextarg = plus_constant (nextarg, -UNITS_PER_WORD);
+  if (! stdarg_p)
+    {
+      int align = PARM_BOUNDARY / BITS_PER_UNIT;
+      int offset = (((UNITS_PER_WORD + align - 1) / align) * align);
+      nextarg = plus_constant (nextarg, -offset);
+    }
 
   t = build (MODIFY_EXPR, TREE_TYPE (valist), valist,
 	     make_tree (ptr_type_node, nextarg));

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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