From patchwork Thu Aug 23 00:11:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cary Coutant X-Patchwork-Id: 179452 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 7D9EB2C0084 for ; Thu, 23 Aug 2012 10:12:20 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1346285541; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Received:Received:To:Subject:Message-Id:Date: From:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=2j3MkFb oUrfj0wlISL/a0tvnN8Y=; b=h7xbJursUjHcA3GOntNlFiSpOTjdnf/qrqb5HIK C/hhMuSYv7DLFzs8lN6G5YdrxdftBeoSGg6McSAkREeaiRTPYSr7dCh52GMV/TvN q1CCXmhnAPB60qs+Q7u9zxNz76NCRKxqVfJ4wUoz3f+jX/3QZCLVS/DlCTSjgGWy qOaA= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:Received:Received:Received:To:Subject:Message-Id:Date:From:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=U+sf50mSp36gCbweoBDzNiT6KLek9xomfSOnnifJ+99bnHJpbQQlwNSI8jzw++ ktkoolLy+fIpJZbMTfCi1khwqS1c3QRKse01ixpzr8GhgN898YnWQupA6MKUkwxX 7oTFRyXo14B+lR0uEi5s54e4ltPWiEdvcHQ3l0bNrXW2s=; Received: (qmail 15926 invoked by alias); 23 Aug 2012 00:12:16 -0000 Received: (qmail 15916 invoked by uid 22791); 23 Aug 2012 00:12:14 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-lpp01m010-f73.google.com (HELO mail-lpp01m010-f73.google.com) (209.85.215.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 23 Aug 2012 00:11:46 +0000 Received: by lahi5 with SMTP id i5so4955lah.2 for ; Wed, 22 Aug 2012 17:11:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:message-id:date:from:x-gm-message-state; bh=8YC1m1V16vob7toHsza53zDG//A2k7W1U/RZhlWChO8=; b=bjtW5zi3wXQBjOxjZQrqz0cfwqTa5ePYH6QoUQrPrOxaK8dPLdWMRipWS9EoqJ+rZB 3GytQY/wSOHJ+7QpX8Uq8w7Qs5dobwUm7TBjUQcKjhjNFBiqxkSq1kF+sKm6uxJsT7P/ q1vEi1EutPW6SqrPqhC67GG2WmNX7GiHVDsrXkRAGYZmF7NHsWdz0A8IoRJ0qweCYLaN zqglnNXFx4tBMIBxbX11bn9wZbQSsiIC3c/0ImBcYgIf1qm6eWbBSy64lIuhfPi/pyz/ PWJAcVZXD1Ry06UO4h53aOCcuj9aWlCE7ZfEAuAZZaOcH2lxIYtwqM9sVIzHZG/B4mTj XssA== Received: by 10.180.82.226 with SMTP id l2mr656850wiy.1.1345680704983; Wed, 22 Aug 2012 17:11:44 -0700 (PDT) Received: by 10.180.82.226 with SMTP id l2mr656847wiy.1.1345680704939; Wed, 22 Aug 2012 17:11:44 -0700 (PDT) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id e5si4716213wiw.0.2012.08.22.17.11.44 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 22 Aug 2012 17:11:44 -0700 (PDT) Received: from ccoutant.mtv.corp.google.com (ccoutant.mtv.corp.google.com [172.18.110.42]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id 88A4D5C0050; Wed, 22 Aug 2012 17:11:44 -0700 (PDT) Received: by ccoutant.mtv.corp.google.com (Postfix, from userid 62097) id C834FE0415; Wed, 22 Aug 2012 17:11:43 -0700 (PDT) To: gcc-patches@gcc.gnu.org, ppluzhnikov@google.com Subject: [google/gcc-4_7] Fix ICE in should_move_die_to_comdat Message-Id: <20120823001143.C834FE0415@ccoutant.mtv.corp.google.com> Date: Wed, 22 Aug 2012 17:11:43 -0700 (PDT) From: ccoutant@google.com (Cary Coutant) X-Gm-Message-State: ALoCoQlq9JNaA7phpkjOA3fTCE40+YJdHNEJ1KcwR2uvZFBq5p9KbKU5b7dJ/i+JIK4mtD84jL+nCkk4IWL9Ly+EliC17N5R8tvEopuDleiqCq+5Y9YyMch15HKeGkbp9DenfTOtthHg+kTQfkYoM+Ffz32odYLwRc87DbV/uTa1didgl+otxWEZpNwztxOBn30D5VGYVHxSfFNddwDIm7yOOrgU0Gyi/N3hYFaBVOdwCWsxsG35wUU= X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch is for the google/gcc-4_7 branch. If a function contains a local typedef of an anonymous structure, GCC will generate a typedef DIE in the function, where the typedef DIE points to a structure_type DIE at the top level. That structure_type DIE, if it's a non-POD, can contain ctor and dtor definitions. This causes an assertion in should_move_die_to_comdat to fail, as we have up to now assumed that this could never happen. Perhaps a better fix would be to fix the generation of the structure_type DIE somehow, but GDB seems happy with what we're generating, and we don't want to extract this type into a comdat type unit anyway, so this patch fixes things up so that we just skip the type instead of asserting. I'll explore other possible fixes for trunk, but this should be good for google/gcc-4_7. Tested with build and validate, and by compiling the failing test case. Google ref b/6669962. 2012-08-22 Cary Coutant * gcc/dwarf2out.c (should_move_die_to_comdat): A type definition can contain a subprogram definition, but don't move it to a comdat unit. Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 190603) +++ gcc/dwarf2out.c (working copy) @@ -7289,14 +7289,13 @@ should_move_die_to_comdat (dw_die_ref di case DW_TAG_structure_type: case DW_TAG_enumeration_type: case DW_TAG_union_type: - /* Don't move declarations, inlined instances, or types nested in a - subprogram. */ + /* Don't move declarations, inlined instances, types nested in a + subprogram, or types that contain subprogram definitions. */ if (is_declaration_die (die) || get_AT (die, DW_AT_abstract_origin) - || is_nested_in_subprogram (die)) + || is_nested_in_subprogram (die) + || contains_subprogram_definition (die)) return 0; - /* A type definition should never contain a subprogram definition. */ - gcc_assert (!contains_subprogram_definition (die)); return 1; case DW_TAG_array_type: case DW_TAG_interface_type: