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]

x86_64 argument passing fix


Hi,
the offset of nested structure fields is computed wrong.  I am
installing the patch to mainline and queueing for 3.2.1. It affects only
the x86_64 specific code but has been bootstrapped on i386.

Sat Aug 10 19:56:31 CEST 2002  Jan Hubicka  <jh@suse.cz>

	* i386.c (classify_argument): Fix computing of field's offsets.

*** i386.c.old	Sat Aug 10 18:58:35 2002
--- i386.c	Sat Aug 10 18:58:38 2002
*************** classify_argument (mode, type, classes, 
*** 1634,1640 ****
  		     return 0;
  		   for (i = 0; i < num; i++)
  		     {
! 		       int pos = (offset + bit_offset) / 8 / 8;
  		       classes[i + pos] =
  			 merge_classes (subclasses[i], classes[i + pos]);
  		     }
--- 1634,1640 ----
  		     return 0;
  		   for (i = 0; i < num; i++)
  		     {
! 		       int pos = (offset + (bit_offset % 64)) / 8 / 8;
  		       classes[i + pos] =
  			 merge_classes (subclasses[i], classes[i + pos]);
  		     }
*************** classify_argument (mode, type, classes, 
*** 1671,1677 ****
  		      for (i = 0; i < num; i++)
  			{
  			  int pos =
! 			    (int_bit_position (field) + bit_offset) / 8 / 8;
  			  classes[i + pos] =
  			    merge_classes (subclasses[i], classes[i + pos]);
  			}
--- 1671,1677 ----
  		      for (i = 0; i < num; i++)
  			{
  			  int pos =
! 			    (int_bit_position (field) + (bit_offset % 64)) / 8 / 8;
  			  classes[i + pos] =
  			    merge_classes (subclasses[i], classes[i + pos]);
  			}
*************** classify_argument (mode, type, classes, 
*** 1717,1723 ****
  
  		   num = classify_argument (TYPE_MODE (type),
  					    type, subclasses,
! 					    (offset + bit_offset) % 256);
  		   if (!num)
  		     return 0;
  		   for (i = 0; i < num; i++)
--- 1717,1723 ----
  
  		   num = classify_argument (TYPE_MODE (type),
  					    type, subclasses,
! 					    (offset + (bit_offset % 64)) % 256);
  		   if (!num)
  		     return 0;
  		   for (i = 0; i < num; i++)


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