This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
va_list_type_node should not have unnamed copy
- To: gcc-patches at gcc dot gnu dot org
- Subject: va_list_type_node should not have unnamed copy
- From: Alexandre Oliva <aoliva at redhat dot com>
- Date: 04 Feb 2001 03:24:34 -0200
- Organization: GCC Team, Red Hat
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 <oldham@codesourcery.com>
* 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 <aoliva@redhat.com>
* 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;
BUILD_VA_LIST_TYPE (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 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