ppc va-arg-10 fix

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Fri Oct 1 14:44:00 GMT 1999


Am Fre, 01 Okt 1999 schrieb Mark Mitchell:
>>That's roughly what I suggested.  One compiler I worked on actually
>did this kind of thing by reading in a magic header file at the
>beginning of every compilation.  This gave a way of making sure you
>got this right; you just said;
>
>  `typedef void *__builtin_va_list;' 
>
>in the header file, and the compiler was sure to do the right thing,
>even if you changed the various front-ends.  I actually like this
>solution pretty well, but GCC doesn't currently do anything like this.

Can you take a look at the appended patch? With it the compiler doesn't
segfault during bootstrap anymore. I modeled it after make_binfo and
make_lang_type from the C++ frontend. But I don't feel very comfortable with
it. Isn't there a better way to do this? Like a function in the C++ frontend
that could "convert" a C va_list tree to a C++ va_list tree?

>
>  BTW, what would be the impact of non-working va_list on general C++ code? 
>  I'm asking cause nearly all (~800) C++ execution tests currently FAIL on 
>  Linux/PPC right now. It would be good to know that the new va_list code 
>  can't have such a bad effect.
>
>I wouldn't think so, but anything's possible.

:-), well, I'll dig into the FAILs then. I checked a few of them and they seem
to segfault in __DTOR_END.

Franz.



Index: rs6000.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.102
diff -u -p -r1.102 rs6000.c
--- rs6000.c	1999/10/01 01:46:41	1.102
+++ rs6000.c	1999/10/01 21:14:10
@@ -1770,6 +1775,27 @@ setup_incoming_varargs (cum, mode, type,
     }
 }
 
+tree
+rs6000_make_binfo (offset, binfo)
+     tree offset, binfo;
+{
+  tree new_binfo = make_tree_vec (7);
+  tree type;
+  
+  type = binfo;
+  binfo = TYPE_BINFO (binfo);
+  
+  TREE_TYPE (new_binfo) = TYPE_MAIN_VARIANT (type);
+  BINFO_OFFSET (new_binfo) = offset;
+  BINFO_VTABLE (new_binfo) = NULL_TREE;
+  BINFO_VIRTUALS (new_binfo) = NULL_TREE;
+  BINFO_VPTR_FIELD (new_binfo) = NULL_TREE;
+  
+  if (binfo && BINFO_BASETYPES (binfo) != NULL_TREE)
+    BINFO_BASETYPES (new_binfo) = copy_node (BINFO_BASETYPES (binfo));
+  return new_binfo;
+}
+
 /* Create the va_list data type.  */
 
 tree
@@ -1777,6 +1803,7 @@ rs6000_build_va_list ()
 {
   tree f_gpr, f_fpr, f_ovf, f_sav, record, type_decl;
   tree uchar_type_node;
+  struct lang_type *pi;
 
   /* Only SVR4 needs something special.  */
   if (DEFAULT_ABI != ABI_V4 && DEFAULT_ABI != ABI_SOLARIS)
@@ -1800,6 +1827,20 @@ rs6000_build_va_list ()
 
   TREE_CHAIN (record) = type_decl;
   TYPE_NAME (record) = type_decl;
+  
+  TYPE_LANG_FLAG_1 (record) = 1;
+  TYPE_LANG_FLAG_5 (record) = 1;
+  
+  if (ggc_p)
+    pi = (struct lang_type *) ggc_alloc (256);
+  else
+    pi = (struct lang_type *) permalloc (256);
+    
+  bzero ((char *) pi, 256);
+  
+  TYPE_LANG_SPECIFIC (record) = pi;
+  TYPE_BINFO (record) = rs6000_make_binfo (integer_zero_node, record);
+
   TYPE_FIELDS (record) = f_gpr;
   TREE_CHAIN (f_gpr) = f_fpr;
   TREE_CHAIN (f_fpr) = f_ovf;


More information about the Gcc-patches mailing list