From patchwork Thu Dec 4 00:21:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Trevor Saunders X-Patchwork-Id: 417595 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9A5271400D5 for ; Thu, 4 Dec 2014 11:23:29 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=ac8xVJo8wUmb 4raoMJs7BZYVQahXFFzPfWP/FbY0z7FdCf+WiihtosMcb6an1GmgavAePTS8auc1 3KJrpYpeLjNUnfJc0EUHDkCdPb8F4FTAbRRppgB0/gZWS4RFjqPpEW9S7uV1ssLt tNTzOEhx7zBN9Vud5BEnsggwI256r+Y= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=3YkyrKPSf5hbkArMoc 1rX/veefI=; b=hZwKUGc5rUG5njjJ7LtUTrnuK/ZDhkr4sYOzdUX8Bo0kgobOqW xLg23Sb/ymcz/VSkyKuEN+zkg5pnDWEwf3HpbSCF8+fHhvAcCqUvl0Y575QFrfPZ l8+1w8iVqGtiZZ1KjTZ59fsgwdI6SjHJUdnp7zFdKLn4KzFCtP4KDhMbQ= Received: (qmail 22187 invoked by alias); 4 Dec 2014 00:23:21 -0000 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 Received: (qmail 22177 invoked by uid 89); 4 Dec 2014 00:23:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp.mozilla.org Received: from mx2.corp.phx1.mozilla.com (HELO smtp.mozilla.org) (63.245.216.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 04 Dec 2014 00:23:19 +0000 Received: from iceball.corp.tor1.mozilla.com (unknown [12.216.224.110]) (Authenticated sender: tsaunders@mozilla.com) by mx2.mail.corp.phx1.mozilla.com (Postfix) with ESMTPSA id 9A81CF2448; Wed, 3 Dec 2014 16:23:17 -0800 (PST) From: tsaunders@mozilla.com To: gcc-patches@gcc.gnu.org Cc: hubicka@ucw.cz, Trevor Saunders Subject: [PATCH] pr63621 - don't ICE when section attribute is used on things in comdats Date: Wed, 3 Dec 2014 19:21:08 -0500 Message-Id: <1417652468-13636-1-git-send-email-tsaunders@mozilla.com> From: Trevor Saunders Hi, In this pr we have a section attribute being applied to something in a comdat group. Since its ok for things to be in a comdat group and have an implicit section it seems it should also be fine to have a section from the attribute. bootstrapped + regtested x86_64-unknown-linux-gnu, ok? Trev gcc/ * symtab.c (symtab_node::verify): Check for section attribute before asserting something isn't in a section and a comdat group. diff --git a/gcc/symtab.c b/gcc/symtab.c index 29839e6..0535670 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -1102,7 +1102,8 @@ symtab_node::verify_base (void) error_found = true; } if (get_section () && get_comdat_group () - && !implicit_section) + && !implicit_section + && !lookup_attribute ("section", DECL_ATTRIBUTES (decl))) { error ("Both section and comdat group is set"); error_found = true; diff --git a/gcc/testsuite/g++.dg/ipa/pr63621.C b/gcc/testsuite/g++.dg/ipa/pr63621.C new file mode 100644 index 0000000..c8262b8 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr63621.C @@ -0,0 +1,29 @@ +// { dg-do compile } + class A +{ + public: + int __attribute__((section("a"))) f1(bool); + int f2(void *); + int f3(bool); +}; + +inline int A::f1(bool b) +{ + static int c; + if (c) + ; + return 0; +} + +inline int A::f3(bool b) +{ + static __attribute__((section(""))) int c; + if (c) + ; + return 0; +} + +int A::f2(void *c) +{ + return f1(c) + f3(c); +}