A sh-elf c++ problem

kaz Kojima kkojima@rr.iij4u.or.jp
Fri Mar 9 05:09:00 GMT 2001


I've got a segfault caused by the null pointer access in compiling
ncurces-5.2/c++/cursesf.cc with sh-elf c++ with -m4. GDB shows that
it's caused by the null TYPE_NAME (type) in write_class_enum_type()
of cp/mangle.c and it seems that this argument "type" is the node
given by sh_build_va_list() of sh.c when the problem occurs.
I found the another implementations like alpha set the TYPE_NAME of
this node at the corresponding place to sh_built_va_list. 
With copying them into sh_build_va_list, the fault goes away.
I'd like to attach the patch, though I don't know this is the right
thing to do.

	kaz
--
Index: sh.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/sh/sh.c,v
retrieving revision 1.89
diff -u -r1.89 sh.c
--- sh.c	2001/02/02 18:20:29	1.89
+++ sh.c	2001/03/09 01:13:50
@@ -4197,12 +4197,15 @@
 sh_build_va_list ()
 {
   tree f_next_o, f_next_o_limit, f_next_fp, f_next_fp_limit, f_next_stack;
-  tree record;
+  tree record, type_decl;
 
   if ((! TARGET_SH3E && ! TARGET_SH4) || TARGET_HITACHI)
     return ptr_type_node;
 
   record = make_node (RECORD_TYPE);
+  type_decl = build_decl (TYPE_DECL, get_identifier ("__va_list_tag"), record);
+  TREE_CHAIN (record) = type_decl;
+  TYPE_NAME (record) = type_decl;
 
   f_next_o = build_decl (FIELD_DECL, get_identifier ("__va_next_o"),
 			 ptr_type_node);



More information about the Gcc-patches mailing list