From patchwork Wed Feb 15 08:39:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 141269 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 9BDC01007D4 for ; Wed, 15 Feb 2012 19:40:42 +1100 (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=1329900042; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:User-Agent:MIME-Version:Message-Id: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=u9CHKqN 2aBNckbUQbaRg1FoM9qo=; b=DHzoELTWKS94yrE4pKs8ZR9DABoIFHlrNwQY7Er Nd1HX13NxGzo/we5ZZdoWHTjw7LKLA8UVIOu/fWbQmMlUvpCycd6EqDp7gatw0dX 2o6OrGNB4fC/6/lMaM5NXIWz4yT6YDWiwP61+ckytKacc0TzPwedBfPsbo2MBLmC s1mk= 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:Message-Id:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=yzwlZr9PqafA7180dAhfWzIDVObnBkNdoTG89SPe4hcrwEKXhnaDUyZnPnNNWX 0GgMVjm4xSWzhWj6zyNe8l7a+qgp6idn008LPbS20iuIzJXPnLh40gQwwu+bdXtV XcRHyOgRt5XXBH1+RJ1K+L6JEJ/gRLDYU9yONj0P5B4EE=; Received: (qmail 29793 invoked by alias); 15 Feb 2012 08:40:38 -0000 Received: (qmail 29782 invoked by uid 22791); 15 Feb 2012 08:40:37 -0000 X-SWARE-Spam-Status: No, hits=-1.9 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; Wed, 15 Feb 2012 08:40:23 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id A037029007C for ; Wed, 15 Feb 2012 09:40:22 +0100 (CET) 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 NUfz-2NMOxsN for ; Wed, 15 Feb 2012 09:40:22 +0100 (CET) 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 69EE4290080 for ; Wed, 15 Feb 2012 09:40:22 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix printing of class-wide tagged type variable in GDB Date: Wed, 15 Feb 2012 09:39:35 +0100 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201202150939.36047.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 This is a regression present on the mainline and which stems from enabling -feliminate-unused-debug-types by default in Ada. We fail to emit the debugging information for tagged types when only the associated class-wide type is referenced in the source code. Tested on i586-suse-linux, applied on the mainline. 2012-02-15 Eric Botcazou * gcc-interface/trans.c (gnat_to_gnu) : If the type is tagged, mark it as used for debugging purposes. : Likewise for a qualified expression. Index: gcc-interface/trans.c =================================================================== --- gcc-interface/trans.c (revision 184257) +++ gcc-interface/trans.c (working copy) @@ -5518,6 +5518,13 @@ gnat_to_gnu (Node_Id gnat_node) gnu_result = gnat_to_gnu (Expression (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node)); + /* If this is a qualified expression for a tagged type, we mark the type + as used. Because of polymorphism, this might be the only reference to + the tagged type in the program while objects have it as dynamic type. + The debugger needs to see it to display these objects properly. */ + if (kind == N_Qualified_Expression && Is_Tagged_Type (Etype (gnat_node))) + used_types_insert (gnu_result_type); + gnu_result = convert_with_check (Etype (gnat_node), gnu_result, Do_Overflow_Check (gnat_node), @@ -5865,18 +5872,19 @@ gnat_to_gnu (Node_Id gnat_node) if (Is_Elementary_Type (gnat_desig_type) || Is_Constrained (gnat_desig_type)) - { - gnu_type = gnat_to_gnu_type (gnat_desig_type); - gnu_init = convert (gnu_type, gnu_init); - } + gnu_type = gnat_to_gnu_type (gnat_desig_type); else { gnu_type = gnat_to_gnu_type (Etype (Expression (gnat_temp))); if (TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE) gnu_type = TREE_TYPE (gnu_init); - - gnu_init = convert (gnu_type, gnu_init); } + + /* See the N_Qualified_Expression case for the rationale. */ + if (Is_Tagged_Type (gnat_desig_type)) + used_types_insert (gnu_type); + + gnu_init = convert (gnu_type, gnu_init); } else gcc_unreachable ();