From patchwork Tue Jun 25 07:23:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 254046 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id E738B2C0085 for ; Tue, 25 Jun 2013 17:25:11 +1000 (EST) 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=YfKd+fWUKfqD35sM YwFItSVRQ2EpSQaGeVbmJVORr0NZAUkECrhSB3dWtZIhH7TcPOkVfz1d9yxVyBe/ P+tYYRJ403I9XPeBV7ELWD/CCEZ/bine5Q5D37k6/TC9Vg2XAnm9C9P3WF8vc9J0 LNPv1xbQLRCVt8xx/8c/6MAI2Uk= 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:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=4MNpyWWEVDgBi8U6L8KWUB 5D3NM=; b=iDxaFKCZNXYTg0IX/sEUJShH8+sY7NrCkLUavEMZfo9HsVhP6WJpYL 3+1Odi6oUuGT8GTQPftOoCxgOVY0L14TfTyrYNuABNCftY0xIozU9zuD6j3pA7+o GJ05Q4U/l6yZb5FHR0Zi0vb2hQQr5yCnEVjaWFMCPeT86Tw+DVVRI= Received: (qmail 1273 invoked by alias); 25 Jun 2013 07:25:04 -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 1252 invoked by uid 89); 25 Jun 2013 07:25:04 -0000 X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00 autolearn=ham version=3.3.1 Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 25 Jun 2013 07:25:02 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 0528C264F53E for ; Tue, 25 Jun 2013 09:22:35 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BCKU09K0NWde for ; Tue, 25 Jun 2013 09:22:34 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id D5455264F53C for ; Tue, 25 Jun 2013 09:22:34 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [patch] Fix error recovery issue with alias Date: Tue, 25 Jun 2013 09:23:46 +0200 Message-ID: <686077088.b1Pk30ZbpY@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.29-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 X-Virus-Found: No Hi, this fixes a segfault on a malformed alias declaration, which is correctly flagged as an error by handle_alias_pairs: error: 'Linker_Alias.Var' aliased to undefined symbol 'var2' but is nevertheless later processed as a valid alias by the cgraph machinery. Bootstrapped/regtested on x86_64-suse-linux, OK for the mainline? 2013-06-25 Eric Botcazou * cgraphunit.c (handle_alias_pairs): Reset the alias flag after the error message is issued for an alias to an undefined symbol. 2013-06-25 Eric Botcazou * gnat.dg/specs/linker_alias.ads: New test. Index: cgraphunit.c =================================================================== --- cgraphunit.c (revision 200350) +++ cgraphunit.c (working copy) @@ -1001,7 +1001,7 @@ analyze_functions (void) /* Translate the ugly representation of aliases as alias pairs into nice representation in callgraph. We don't handle all cases yet, - unforutnately. */ + unfortunately. */ static void handle_alias_pairs (void) @@ -1013,10 +1013,11 @@ handle_alias_pairs (void) { symtab_node target_node = symtab_node_for_asm (p->target); - /* Weakrefs with target not defined in current unit are easy to handle; they - behave just as external variables except we need to note the alias flag - to later output the weakref pseudo op into asm file. */ - if (!target_node && lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl)) != NULL) + /* Weakrefs with target not defined in current unit are easy to handle: + they behave just as external variables except we need to note the + alias flag to later output the weakref pseudo op into asm file. */ + if (!target_node + && lookup_attribute ("weakref", DECL_ATTRIBUTES (p->decl)) != NULL) { symtab_node node = symtab_get_node (p->decl); if (node) @@ -1031,6 +1032,9 @@ handle_alias_pairs (void) else if (!target_node) { error ("%q+D aliased to undefined symbol %qE", p->decl, p->target); + symtab_node node = symtab_get_node (p->decl); + if (node) + node->symbol.alias = false; alias_pairs->unordered_remove (i); continue; }