This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

[PATCH][TUPLES] Fix for segmentation fault during libjava build.


I am going to commit this patch to the branch after this e-mail.
Diego has approved it already.

-Doug


2008-05-02  Doug Kwan  <dougkwan@google.com>
	
	* expr.c (build_java_throw_out_of_bounds_exception ): Wrap call to
	_Jv_ThrowBadArrayIndex with a COMPOUND_EXPR to return 0.

Index: expr.c
===================================================================
--- expr.c	(revision 134887)
+++ expr.c	(working copy)
@@ -814,10 +814,18 @@
 static tree
 build_java_throw_out_of_bounds_exception (tree index)
 {
-  tree node = build_call_nary (int_type_node,
+  /* We need to build a COMPOUND_EXPR because _Jv_ThrowBadArrayIndex()
+     has void return type.  We cannot just set the type of the CALL_EXPR below
+     to int_type_node because we would lose it during gimplification.  */
+  gcc_assert (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (soft_badarrayindex_node))));
+  tree node = build_call_nary (void_type_node,
 			       build_address_of (soft_badarrayindex_node),
 			       1, index);
+  TREE_SIDE_EFFECTS (node) = 1;
+
+  node = build2 (COMPOUND_EXPR, int_type_node, node, integer_zero_node);
   TREE_SIDE_EFFECTS (node) = 1;	/* Allows expansion within ANDIF */
+
   return (node);
 }


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