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

Re: armv4l bootstrap problem in libstdc++-v3


Hi Rod, Hi Richard, Hi Mark,

  I have tracked down the cause of the libstdc++-v3 build failure for
  the ARM. I even have a patch that fixes the problem, although I am
  doubt if the the patch will be accepted :-(

  Anyway, the problem is that the type hashing function used in tree.c
  does not take into account the fact that C++ uses the unsigned_flag
  field in the tree node of the first parameter in a list to indicate
  a parameter list instead of an expression list.

  This means that when arm_init_builtins() creates a "void (char *)"
  function type (without the TREE_PARMLIST bit set on its arguments)
  this type is cached.  Then later on when the G++ compiler is
  compiling strstream.cc it sees the declaration of _M_free, creates
  another "void (char *)" type for it (but this time with
  TREE_PARMLIST set), passes this to build_function_type, which hashes
  it, matches the type created by arm_init_builtins, and so returns
  the older type, now with TREE_PARMLIST unset.

  My fix is to add code to build_function_type to alter the computed
  hashcode based on the presence of the TREE_PARMLIST bit.  It
  appears to work (although I have not yet completed a full rebuild),
  but I do not know if adding specialist C++ knowledge to a generic
  gcc function is the right thing to do.

  Comments ?

Cheers
	Nick


2000-12-20  Nick Clifton  <nickc@redhat.com>

	* tree.c (build_function_type): Detect the presence of
	TREE_PARMLIST in C++ parameter lists and adjust the hash code
	accordingly.

Index: tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/tree.c,v
retrieving revision 1.177
diff -p -r1.177 tree.c
*** tree.c	2000/11/27 07:09:19	1.177
--- tree.c	2000/12/20 20:25:22
*************** build_function_type (value_type, arg_typ
*** 3879,3886 ****
  
    /* If we already have such a type, use the old one and free this one.  */
    hashcode = TYPE_HASH (value_type) + type_hash_list (arg_types);
-   t = type_hash_canon (hashcode, t);
  
    if (!COMPLETE_TYPE_P (t))
      layout_type (t);
    return t;
--- 3879,3895 ----
  
    /* If we already have such a type, use the old one and free this one.  */
    hashcode = TYPE_HASH (value_type) + type_hash_list (arg_types);
  
+   if (arg_types && TREE_CHAIN (arg_types))
+     {
+       /* In C++ the TREE_UNSIGNED field is used to distinguish a parameter
+ 	 list from a list of expressions.  We must make sure that this bit
+ 	 is preserved in whichever type we select.  */
+       hashcode += TREE_UNSIGNED (TREE_CHAIN (arg_types)) ? 1 : 0;
+     }
+   
+   t = type_hash_canon (hashcode, t);
+   
    if (!COMPLETE_TYPE_P (t))
      layout_type (t);
    return t;


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