This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][TUPLES] Fix for segmentation fault during libjava build.
- From: "=?big5?b?RG91ZyBLd2FuICjD9q62vHcp?=" <dougkwan at google dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: "Diego Novillo" <dnovillo at google dot com>
- Date: Fri, 2 May 2008 12:39:06 -0700
- Subject: [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);
}