Major 3.1 branch Java regressions

David S. Miller davem@redhat.com
Thu May 16 19:52:00 GMT 2002


Java fails to be able to compile any of the testsuite on
the 3.1 branch now, have a look at recent gcc-testresults
submissions, for example:
http://gcc.gnu.org/ml/gcc-testresults/2002-05/msg00603.html
The only functional changes from the 3.1 release to the current branch
are c++ frontend changes. I heavily suspect them and I include the
c++ frontend diff between 3.1 and current branch below.
Jason/Alexander, did you guys run the java testsuite before
installing your changes on the branch?
I am now doing a build with all of these changes reverted, but it
would not surprise me if the java problems go away as a result.
diff -u --recursive --new-file --exclude=CVS --exclude=.cvsignore ../../gcc-3.1/gcc/cp/ChangeLog gcc/gcc/cp/ChangeLog
--- ../../gcc-3.1/gcc/cp/ChangeLog	Tue May 14 19:19:33 2002
+++ gcc/gcc/cp/ChangeLog	Thu May 16 01:57:39 2002
@@ -1,6 +1,25 @@
-2002年05月14日 Release Manager
+2002年05月09日 Jason Merrill <jason@redhat.com>
 
-	* GCC 3.1 Released.
+	* pt.c (tsubst_expr) [ASM_STMT]: Copy ASM_INPUT_P.
+
+2002年05月15日 Alexandre Oliva <aoliva@redhat.com>
+
+	* cp-tree.h (struct lang_type): Added non_zero_init.
+	(CLASS_NON_ZERO_INIT_P): New macro.
+	(zero_init_p, force_store_init_value, build_forced_zero_init): Declare.
+	* class.c (check_field_decls): Test non_zero_init.
+	* cvt.c (convert_to_pointer_force): Use cp_convert_to_pointer for
+	zero-to-NULL conversions.
+	* decl.c (obscure_complex_init): Don't reset DECL_INITIAL of a
+	type that needs zero-initialization without zeros.
+	(check_initializer_decl): Compute zero-initializer for types
+	that require a non-trivial one.
+	* init.c (build_forced_zero_init): New function.
+	(build_default_init): Use it.
+	* tree.c (zero_init_p): New function.
+	* typeck2.c (force_store_init_value): New function.
+	(process_init_constructor): Create non-trivial zero-initializers
+	for array members and class fields.
 
 2002年05月14日 Release Manager
 
@@ -34,6 +53,7 @@
 
 2002年04月30日 Jason Merrill <jason@redhat.com>
 
+	PR debug/6436
 	* decl.c (grokdeclarator): Don't override TYPE_NAME of an
 	anonymous class with a typedef if there are attributes.
 
diff -u --recursive --new-file --exclude=CVS --exclude=.cvsignore ../../gcc-3.1/gcc/cp/class.c gcc/gcc/cp/class.c
--- ../../gcc-3.1/gcc/cp/class.c	Tue Apr 30 14:53:02 2002
+++ gcc/gcc/cp/class.c	Thu May 16 01:57:45 2002
@@ -3410,6 +3410,9 @@
 to be allowed in POD structs. */
 	CLASSTYPE_NON_POD_P (t) = 1;
 
+ if (! zero_init_p (type))
+	CLASSTYPE_NON_ZERO_INIT_P (t) = 1;
+
 /* If any field is const, the structure type is pseudo-const. */
 if (CP_TYPE_CONST_P (type))
 	{
diff -u --recursive --new-file --exclude=CVS --exclude=.cvsignore ../../gcc-3.1/gcc/cp/cp-tree.h gcc/gcc/cp/cp-tree.h
--- ../../gcc-3.1/gcc/cp/cp-tree.h	Tue Apr 23 14:51:13 2002
+++ gcc/gcc/cp/cp-tree.h	Thu May 16 02:02:08 2002
@@ -1245,6 +1245,8 @@
 unsigned is_partial_instantiation : 1;
 unsigned java_interface : 1;
 
+ unsigned non_zero_init : 1;
+
 /* When adding a flag here, consider whether or not it ought to
 apply to a template instance if it applies to the template. If
 so, make sure to copy it in instantiate_class_template! */
@@ -1252,7 +1254,7 @@
 /* There are some bits left to fill out a 32-bit word. Keep track
 of this by updating the size of this bitfield whenever you add or
 remove a flag. */
- unsigned dummy : 8;
+ unsigned dummy : 7;
 
 int vsize;
 
@@ -1500,9 +1502,14 @@
 #define CLASSTYPE_HAS_MUTABLE(NODE) (TYPE_LANG_SPECIFIC (NODE)->has_mutable)
 #define TYPE_HAS_MUTABLE_P(NODE) (cp_has_mutable_p (NODE))
 
-/* Nonzero means that this class type is a non-POD class. */
+/* Nonzero means that this class type is a non-POD class. */
 #define CLASSTYPE_NON_POD_P(NODE) (TYPE_LANG_SPECIFIC (NODE)->non_pod_class)
 
+/* Nonzero means that this class contains pod types whose default
+ initialization is not a zero initialization (namely, pointers to
+ data members). */
+#define CLASSTYPE_NON_ZERO_INIT_P(NODE) (TYPE_LANG_SPECIFIC (NODE)->non_zero_init)
+
 /* Nonzero if this class is "nearly empty", i.e., contains only a
 virtual function table pointer. */
 #define CLASSTYPE_NEARLY_EMPTY_P(NODE) \
@@ -3900,6 +3907,7 @@
 extern int is_aggr_type				PARAMS ((tree, int));
 extern tree get_aggr_from_typedef		PARAMS ((tree, int));
 extern tree get_type_value			PARAMS ((tree));
+extern tree build_forced_zero_init		PARAMS ((tree));
 extern tree build_member_call			PARAMS ((tree, tree, tree));
 extern tree build_offset_ref			PARAMS ((tree, tree));
 extern tree resolve_offset_ref			PARAMS ((tree));
@@ -4212,6 +4220,7 @@
 /* in tree.c */
 extern void init_tree			 PARAMS ((void));
 extern int pod_type_p				PARAMS ((tree));
+extern int zero_init_p				PARAMS ((tree));
 extern tree canonical_type_variant PARAMS ((tree));
 extern void unshare_base_binfos			PARAMS ((tree));
 extern int member_p				PARAMS ((tree));
@@ -4357,6 +4366,7 @@
 #define my_friendly_assert(EXP, N) (void) \
 (((EXP) == 0) ? (fancy_abort (__FILE__, __LINE__, __FUNCTION__), 0) : 0)
 
+extern tree force_store_init_value		PARAMS ((tree, tree));
 extern tree store_init_value			PARAMS ((tree, tree));
 extern tree digest_init				PARAMS ((tree, tree, tree *));
 extern tree build_scoped_ref			PARAMS ((tree, tree));
diff -u --recursive --new-file --exclude=CVS --exclude=.cvsignore ../../gcc-3.1/gcc/cp/cvt.c gcc/gcc/cp/cvt.c
--- ../../gcc-3.1/gcc/cp/cvt.c	Wed Apr 24 15:40:59 2002
+++ gcc/gcc/cp/cvt.c	Thu May 16 02:02:08 2002
@@ -1,6 +1,6 @@
 /* Language-level data type conversion for GNU C++.
 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 Hacked by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GNU CC.
@@ -285,13 +285,6 @@
 register tree intype = TREE_TYPE (expr);
 register enum tree_code form = TREE_CODE (intype);
 
- if (integer_zerop (expr))
- {
- expr = build_int_2 (0, 0);
- TREE_TYPE (expr) = type;
- return expr;
- }
-
 if (form == POINTER_TYPE)
 {
 intype = TYPE_MAIN_VARIANT (intype);
diff -u --recursive --new-file --exclude=CVS --exclude=.cvsignore ../../gcc-3.1/gcc/cp/decl.c gcc/gcc/cp/decl.c
--- ../../gcc-3.1/gcc/cp/decl.c	Fri May 3 11:55:23 2002
+++ gcc/gcc/cp/decl.c	Thu May 16 02:02:08 2002
@@ -7605,7 +7605,13 @@
 				 NULL_TREE);
 else
 #endif
- DECL_INITIAL (decl) = error_mark_node;
+ {
+ if (zero_init_p (TREE_TYPE (decl)))
+	DECL_INITIAL (decl) = error_mark_node;
+ /* Otherwise, force_store_init_value will have already stored a
+	 zero-init initializer in DECL_INITIAL, that should be
+	 retained. */
+ }
 
 return init;
 }
@@ -7851,8 +7857,16 @@
 if (init)
 	init = obscure_complex_init (decl, init);
 }
+ else if (!DECL_EXTERNAL (decl) && !zero_init_p (type))
+ {
+ force_store_init_value (decl, build_forced_zero_init (type));
+
+ if (init)
+	goto process_init;
+ }
 else if (init)
 {
+ process_init:
 if (TYPE_HAS_CONSTRUCTOR (type) || TYPE_NEEDS_CONSTRUCTING (type))
 	{
 	 if (TREE_CODE (type) == ARRAY_TYPE)
diff -u --recursive --new-file --exclude=CVS --exclude=.cvsignore ../../gcc-3.1/gcc/cp/init.c gcc/gcc/cp/init.c
--- ../../gcc-3.1/gcc/cp/init.c	Thu May 2 13:02:41 2002
+++ gcc/gcc/cp/init.c	Thu May 16 02:02:08 2002
@@ -1,6 +1,6 @@
 /* Handle initialization things in C++.
 Copyright (C) 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 Contributed by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GNU CC.
@@ -176,6 +176,44 @@
 	 dfs_marked_real_bases_queue_p, type);
 }
 
+/* Types containing pointers to data members cannot be
+ zero-initialized with zeros, because the NULL value for such
+ pointers is -1.
+
+ TYPE is a type that requires such zero initialization. The
+ returned value is the initializer. */
+
+tree
+build_forced_zero_init (type)
+ tree type;
+{
+ tree init = NULL;
+
+ if (AGGREGATE_TYPE_P (type) && !TYPE_PTRMEMFUNC_P (type))
+ {
+ /* This is a default initialization of an aggregate, but not one of
+	 non-POD class type. We cleverly notice that the initialization
+	 rules in such a case are the same as for initialization with an
+	 empty brace-initialization list. */
+ init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, NULL_TREE);
+ }
+ else if (TREE_CODE (type) == REFERENCE_TYPE)
+ /* --if T is a reference type, no initialization is performed. */
+ return NULL_TREE;
+ else
+ {
+ init = integer_zero_node;
+ 
+ if (TREE_CODE (type) == ENUMERAL_TYPE)
+ /* We must make enumeral types the right type. */
+ init = fold (build1 (NOP_EXPR, type, init));
+ }
+
+ init = digest_init (type, init, 0);
+
+ return init;
+}
+
 /* [dcl.init]:
 
 To default-initialize an object of type T means:
@@ -202,28 +240,8 @@
 anything with a CONSTRUCTOR for arrays here, as that would imply
 copy-initialization. */
 return NULL_TREE;
- else if (AGGREGATE_TYPE_P (type) && !TYPE_PTRMEMFUNC_P (type))
- {
- /* This is a default initialization of an aggregate, but not one of
-	 non-POD class type. We cleverly notice that the initialization
-	 rules in such a case are the same as for initialization with an
-	 empty brace-initialization list. */
- init = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, NULL_TREE);
- }
- else if (TREE_CODE (type) == REFERENCE_TYPE)
- /* --if T is a reference type, no initialization is performed. */
- return NULL_TREE;
- else
- {
- init = integer_zero_node;
- 
- if (TREE_CODE (type) == ENUMERAL_TYPE)
- /* We must make enumeral types the right type. */
- init = fold (build1 (NOP_EXPR, type, init));
- }
 
- init = digest_init (type, init, 0);
- return init;
+ return build_forced_zero_init (type);
 }
 
 /* Subroutine of emit_base_init. */
diff -u --recursive --new-file --exclude=CVS --exclude=.cvsignore ../../gcc-3.1/gcc/cp/pt.c gcc/gcc/cp/pt.c
--- ../../gcc-3.1/gcc/cp/pt.c	Tue Apr 30 12:43:56 2002
+++ gcc/gcc/cp/pt.c	Thu May 16 02:02:08 2002
@@ -7502,12 +7502,13 @@
 
 case ASM_STMT:
 prep_stmt (t);
- finish_asm_stmt (ASM_CV_QUAL (t),
-		 tsubst_expr (ASM_STRING (t), args, complain, in_decl),
-		 tsubst_expr (ASM_OUTPUTS (t), args, complain, in_decl),
-		 tsubst_expr (ASM_INPUTS (t), args, complain, in_decl), 
-		 tsubst_expr (ASM_CLOBBERS (t), args, complain,
-				 in_decl));
+ tmp = finish_asm_stmt
+	(ASM_CV_QUAL (t),
+	 tsubst_expr (ASM_STRING (t), args, complain, in_decl),
+	 tsubst_expr (ASM_OUTPUTS (t), args, complain, in_decl),
+	 tsubst_expr (ASM_INPUTS (t), args, complain, in_decl), 
+	 tsubst_expr (ASM_CLOBBERS (t), args, complain, in_decl));
+ ASM_INPUT_P (tmp) = ASM_INPUT_P (t);
 break;
 
 case TRY_BLOCK:
diff -u --recursive --new-file --exclude=CVS --exclude=.cvsignore ../../gcc-3.1/gcc/cp/tree.c gcc/gcc/cp/tree.c
--- ../../gcc-3.1/gcc/cp/tree.c	Wed Apr 24 17:14:25 2002
+++ gcc/gcc/cp/tree.c	Thu May 16 02:02:08 2002
@@ -1,6 +1,6 @@
 /* Language-dependent node constructors for parse phase of GNU compiler.
 Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 Hacked by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GNU CC.
@@ -1895,6 +1895,27 @@
 return 0; /* other non-class type (reference or function) */
 if (CLASSTYPE_NON_POD_P (t))
 return 0;
+ return 1;
+}
+
+/* Returns 1 iff zero initialization of type T means actually storing
+ zeros in it. */
+
+int
+zero_init_p (t)
+ tree t;
+{
+ t = strip_array_types (t);
+
+ /* NULL pointers to data members are initialized with -1. */
+ if (TYPE_PTRMEM_P (t))
+ return 0;
+
+ /* Classes that contain types that can't be zero-initialized, cannot
+ be zero-initialized themselves. */
+ if (CLASS_TYPE_P (t) && CLASSTYPE_NON_ZERO_INIT_P (t))
+ return 0;
+
 return 1;
 }
 
diff -u --recursive --new-file --exclude=CVS --exclude=.cvsignore ../../gcc-3.1/gcc/cp/typeck2.c gcc/gcc/cp/typeck2.c
--- ../../gcc-3.1/gcc/cp/typeck2.c	Wed Feb 13 09:32:24 2002
+++ gcc/gcc/cp/typeck2.c	Thu May 16 02:02:08 2002
@@ -1,7 +1,7 @@
 /* Report error messages, build initializers, and perform
 some front-end optimizations for C++ compiler.
 Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 Hacked by Michael Tiemann (tiemann@cygnus.com)
 
 This file is part of GNU CC.
@@ -420,6 +420,28 @@
 DECL_INITIAL (decl) = value;
 return NULL_TREE;
 }
+
+/* Same as store_init_value, but used for known-to-be-valid static
+ initializers. Used to introduce a static initializer even in data
+ structures that may require dynamic initialization. */
+
+tree
+force_store_init_value (decl, init)
+ tree decl, init;
+{
+ tree type = TREE_TYPE (decl);
+ int needs_constructing = TYPE_NEEDS_CONSTRUCTING (type);
+
+ TYPE_NEEDS_CONSTRUCTING (type) = 0;
+
+ init = store_init_value (decl, init);
+ if (init)
+ abort ();
+
+ TYPE_NEEDS_CONSTRUCTING (type) = needs_constructing;
+
+ return init;
+} 
 
 /* Digest the parser output INIT as an initializer for type TYPE.
 Return a C expression of type TYPE to represent the initial value.
@@ -732,6 +754,8 @@
 		next1 = build (CONSTRUCTOR, NULL_TREE, NULL_TREE, NULL_TREE);
 	 next1 = digest_init (TREE_TYPE (type), next1, 0);
 	 }
+	 else if (! zero_init_p (TREE_TYPE (type)))
+	 next1 = build_forced_zero_init (TREE_TYPE (type));
 	 else
 	 /* The default zero-initialization is fine for us; don't
 	 add anything to the CONSTRUCTOR. */
@@ -848,9 +872,12 @@
 	 && (!init || TREE_HAS_CONSTRUCTOR (init)))
 		warning ("missing initializer for member `%D'", field);
 
-	 /* The default zero-initialization is fine for us; don't
-		 add anything to the CONSTRUCTOR. */
-	 continue;
+	 if (! zero_init_p (TREE_TYPE (field)))
+		next1 = build_forced_zero_init (TREE_TYPE (field));
+	 else
+		/* The default zero-initialization is fine for us; don't
+		 add anything to the CONSTRUCTOR. */
+		continue;
 	 }
 
 	 if (next1 == error_mark_node)


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /