From d2ff90cc580c62afb8528917c1c80ac49d9aaa01 Mon Sep 17 00:00:00 2001 From: kan Date: Tue, 14 Aug 2007 02:45:23 +0000 Subject: GCC 4.2.1 release. --- contrib/gcc/cp/class.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'contrib/gcc/cp/class.c') diff --git a/contrib/gcc/cp/class.c b/contrib/gcc/cp/class.c index ff1d84b..1f30524 100644 --- a/contrib/gcc/cp/class.c +++ b/contrib/gcc/cp/class.c @@ -5350,22 +5350,34 @@ fixed_type_or_null (tree instance, int* nonnull, int* cdtorp) } else if (TREE_CODE (TREE_TYPE (instance)) == REFERENCE_TYPE) { + /* We only need one hash table because it is always left empty. */ + static htab_t ht; + if (!ht) + ht = htab_create (37, + htab_hash_pointer, + htab_eq_pointer, + /*htab_del=*/NULL); + /* Reference variables should be references to objects. */ if (nonnull) *nonnull = 1; - /* DECL_VAR_MARKED_P is used to prevent recursion; a + /* Enter the INSTANCE in a table to prevent recursion; a variable's initializer may refer to the variable itself. */ if (TREE_CODE (instance) == VAR_DECL && DECL_INITIAL (instance) - && !DECL_VAR_MARKED_P (instance)) + && !htab_find (ht, instance)) { tree type; - DECL_VAR_MARKED_P (instance) = 1; + void **slot; + + slot = htab_find_slot (ht, instance, INSERT); + *slot = instance; type = fixed_type_or_null (DECL_INITIAL (instance), nonnull, cdtorp); - DECL_VAR_MARKED_P (instance) = 0; + htab_remove_elt (ht, instance); + return type; } } -- cgit v1.1