From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24185 invoked by alias); 20 Aug 2008 23:41:56 -0000 Received: (qmail 24171 invoked by uid 22791); 20 Aug 2008 23:41:56 -0000 X-Spam-Check-By: sourceware.org Received: from smtp1.dnsmadeeasy.com (HELO smtp1.dnsmadeeasy.com) (205.234.170.134) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 20 Aug 2008 23:41:17 +0000 Received: from smtp1.dnsmadeeasy.com (localhost [127.0.0.1]) by smtp1.dnsmadeeasy.com (Postfix) with ESMTP id 84DAC320B52; Wed, 20 Aug 2008 23:41:32 +0000 (UTC) X-Authenticated-Name: js.dnsmadeeasy X-Transit-System: In case of SPAM please contact abuse@dnsmadeeasy.com Received: from avtrex.com (unknown [67.116.42.147]) by smtp1.dnsmadeeasy.com (Postfix) with ESMTP; Wed, 20 Aug 2008 23:41:32 +0000 (UTC) Received: from dl2.hq2.avtrex.com ([192.168.7.26]) by avtrex.com with Microsoft SMTPSVC(6.0.3790.1830); Wed, 20 Aug 2008 16:41:14 -0700 Message-ID: <48ACAB98.5050504@avtrex.com> Date: Thu, 21 Aug 2008 00:16:00 -0000 From: David Daney User-Agent: Thunderbird 2.0.0.16 (X11/20080723) MIME-Version: 1.0 To: Java Patch List , gcc-patches Subject: [Patch] Fix ICE with java and -freduced-reflection. Content-Type: multipart/mixed; boundary="------------070604030809070105030605" X-IsSubscribed: yes Mailing-List: contact java-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-patches-owner@gcc.gnu.org X-SW-Source: 2008-q3/txt/msg00043.txt.bz2 This is a multi-part message in MIME format. --------------070604030809070105030605 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 846 When compiling certain java programs (like libgcj) with freduced-reflection, jc1 will ICE with SIGSEGV. The cause is a small logic error in make_class_data(tree). We allocate a VEC of length zero with VEC_alloc(int, heap, 0) which returns NULL, but then try to add an element with VEC_quick_push() resulting in SIGSEGV as the VEC is NULL. We should only be adding the field indexes if they are static or (uses_jv_markobj || !flag_reduced_reflection), but we unconditionally fall through and always add something. The fix is to continue the loop if the conditions for field inclusion are not met and not add the bogus index. Currently bootstrapping/testing on i686-pc-linux-gnu. OK to commit if it passes? 2008-08-20 David Daney * class.c (make_class_data): Don't add field_index when flag_reduced_reflection set. --------------070604030809070105030605 Content-Type: text/x-patch; name="class.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="class.patch" Content-length: 412 Index: class.c =================================================================== --- class.c (revision 139335) +++ class.c (working copy) @@ -1821,6 +1821,8 @@ make_class_data (tree type) field_index = static_count++; else if (uses_jv_markobj || !flag_reduced_reflection) field_index = instance_count++; + else + continue; VEC_quick_push (int, field_indexes, field_index); } } --------------070604030809070105030605--