This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[BC ABI] Use PARM_DECLs preferentially


This is for a corner case that tromey found when compiling Eclipse.
We were creating a new local variable for a slot that held a parameter
in the case where the access was of a different type.

Tom, please test this.

2004-09-24  Andrew Haley  <aph@redhat.com>

	* decl.c (check_local_unnamed_variable): Always use the PARM_DECL
	for a slot if it's of pointer type.

Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/decl.c,v
retrieving revision 1.178.4.9
diff -u -w -r1.178.4.9 decl.c
--- decl.c	14 Sep 2004 21:12:02 -0000	1.178.4.9
+++ decl.c	24 Sep 2004 14:43:24 -0000
@@ -246,8 +246,19 @@
 	  && TYPE_PRECISION (decl_type) <= 32
 	    && TYPE_PRECISION (type) <= 32
 	  && TYPE_PRECISION (decl_type) >= TYPE_PRECISION (type))      
-	|| (TREE_CODE (TREE_TYPE (decl)) == POINTER_TYPE
-	    && type == ptr_type_node))
+      /*  ptr_type_node is used for null pointers, which are
+	 assignment compatible with everything.  */
+      || (TREE_CODE (decl_type) == POINTER_TYPE
+	  && type == ptr_type_node)
+      /* Whenever anyone wants to use a slot that is initially
+	 occupied by a PARM_DECL of pointer type they must get that
+	 decl, even if they asked for a pointer to a different type.
+	 However, if someone wants a scalar variable in a slot that
+	 initially held a pointer arg -- or vice versa -- we create a
+	 new VAR_DECL.  */
+      || (TREE_CODE (decl_type) == POINTER_TYPE
+	  && TREE_CODE (decl) == PARM_DECL
+	  && TREE_CODE (type) == POINTER_TYPE))
       {
 	if (best == NULL_TREE
 	  || (decl_type == type && TREE_TYPE (best) != type))


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