From patchwork Tue Jul 3 07:52:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 168726 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 1A1F72C00F4 for ; Tue, 3 Jul 2012 17:59:42 +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=1341907184; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:User-Agent:MIME-Version: Content-Type:Message-Id:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=8yWA8g54sCEH3xR9BQpVPcj7Eyc=; b=N8VWdpljuaez7nC 6nHmJ7yk6xlVeqhG0ofNBQ+3hdtXQHXLU4kg9Yg9Q0Vg8qhRs62Vtkm0C3pb3GaY GadLigmp8oZx/zjw4VB9clAOgltw8LZXB5Wsc6LZeaq/c2XN5EUHpGg0PLFnddkL SNgWbF8R7ze3xdsNtJmUP8i478qQ= 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:Received:Received:From:To:Subject:Date:User-Agent:MIME-Version:Content-Type:Message-Id:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=x6bgadoJNJzJ0hv5Bq4prmpxXyYtXVaYxe2jcdRomjXrYPfSLXIE3Xkwfi/xpJ 5zV147OGKnZ/1k6M+/U7qgS4Zdc+mslZSZjmu6DG/KyCLU6NiHOqSl9DktRBskH2 5QcutdfKVjCb0B6Knh1w3jJQd3WukYtJCpDr9pzyedI/k=; Received: (qmail 17683 invoked by alias); 3 Jul 2012 07:59:34 -0000 Received: (qmail 17652 invoked by uid 22791); 3 Jul 2012 07:59:32 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Jul 2012 07:59:10 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 3E6A8290046 for ; Tue, 3 Jul 2012 09:59:15 +0200 (CEST) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eobbHSAbqoD4 for ; Tue, 3 Jul 2012 09:59:15 +0200 (CEST) Received: from [192.168.1.2] (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 0A981290022 for ; Tue, 3 Jul 2012 09:59:14 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Adjust to change in handling of local types with -g Date: Tue, 3 Jul 2012 09:52:05 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201207030952.05932.ebotcazou@adacore.com> 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 The fix for PR c++/52637 slightly broke the handling of local types in Ada. The attached patch restores correct generation of debug info for them. Tested on i586-suse-linux, applied on mainline and 4.7 branch. 2012-07-03 Eric Botcazou * gcc-interface/utils.c (gnat_pushdecl): Set TYPE_CONTEXT for types attached to a TYPE_DECL. Index: gcc-interface/utils.c =================================================================== --- gcc-interface/utils.c (revision 189034) +++ gcc-interface/utils.c (working copy) @@ -612,6 +612,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_n if (TREE_CODE (t) == POINTER_TYPE) TYPE_NEXT_PTR_TO (t) = tt; TYPE_NAME (tt) = DECL_NAME (decl); + TYPE_CONTEXT (tt) = DECL_CONTEXT (decl); TYPE_STUB_DECL (tt) = TYPE_STUB_DECL (t); DECL_ORIGINAL_TYPE (decl) = tt; } @@ -621,6 +622,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_n /* We need a variant for the placeholder machinery to work. */ tree tt = build_variant_type_copy (t); TYPE_NAME (tt) = decl; + TYPE_CONTEXT (tt) = DECL_CONTEXT (decl); TREE_USED (tt) = TREE_USED (t); TREE_TYPE (decl) = tt; if (DECL_ORIGINAL_TYPE (TYPE_NAME (t))) @@ -640,7 +642,10 @@ gnat_pushdecl (tree decl, Node_Id gnat_n if (t) for (t = TYPE_MAIN_VARIANT (t); t; t = TYPE_NEXT_VARIANT (t)) if (!(TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL)) - TYPE_NAME (t) = decl; + { + TYPE_NAME (t) = decl; + TYPE_CONTEXT (t) = DECL_CONTEXT (decl); + } } }