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

va_list_type_node should not have unnamed copy

Several back-ends have BUILD_VA_LIST_TYPE return a RECORD_TYPE without
a name.  This used to work because c_common_nodes_and_builtins() would
introduce a declaration to va_list_type_node, that would end up giving
it a name.

2000-12-30  Jeffrey Oldham  <>

	* defaults.h (BUILD_VA_LIST_TYPE): New definition.
	* tree.c (build_common_tree_nodes_2): Ensure the va_list_type_node
	is a copy, not an alias.

This patch broke these platforms, because now an unnamed record type
remains, and, since it's marked as the original type of the copy, it's
used for name mangling, that assumes each record type must have a
non-NULL name.  Oops.

The patch was supposed to address the problem of having the name of
ptr_type_node modified by the introduction of the declaration of
va_list_type_node, on platforms that had va_list_type_node aliased to
ptr_type_node.  When a record type is returned, copying is harmful and
unnecessary.  So, don't do it.  Tested on sh-elf, that uses
ptr_type_node for some multilibs and a record_type for others.

Ok to install?

Index: gcc/ChangeLog
from  Alexandre Oliva  <>

	* tree.c (build_common_tree_nodes_2): Don't copy va_list_type_node
	if it's a record type.

Index: gcc/tree.c
RCS file: /cvs/gcc/egcs/gcc/tree.c,v
retrieving revision 1.183
diff -u -p -r1.183 tree.c
--- gcc/tree.c 2001/01/29 18:57:19 1.183
+++ gcc/tree.c 2001/02/04 05:13:29
@@ -4814,7 +4814,16 @@ build_common_tree_nodes_2 (short_double)
     tree t;
-    va_list_type_node = build_type_copy (t);
+    /* Many back-ends define record types without seting TYPE_NAME.
+       If we copied the record type here, we'd keep the original
+       record type without a name.  This breaks name mangling.  So,
+       don't copy record types and let c_common_nodes_and_builtins()
+       declare the type to be __builtin_va_list.  */
+    if (TREE_CODE (t) != RECORD_TYPE)
+      t = build_type_copy (t);
+    va_list_type_node = t;
   V4SF_type_node = make_node (VECTOR_TYPE);

Alexandre Oliva   Enjoy Guarana', see
Red Hat GCC Developer                  aoliva@{,}
CS PhD student at IC-Unicamp        oliva@{,}
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]