From patchwork Mon Dec 13 18:09:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 75387 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 3CC76B7043 for ; Tue, 14 Dec 2010 05:11:10 +1100 (EST) Received: (qmail 30102 invoked by alias); 13 Dec 2010 18:11:06 -0000 Received: (qmail 30094 invoked by uid 22791); 13 Dec 2010 18:11:05 -0000 X-SWARE-Spam-Status: No, hits=-2.0 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; Mon, 13 Dec 2010 18:11:00 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 4A153CB02CB for ; Mon, 13 Dec 2010 19:10:58 +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 qb13hdC0xAJV for ; Mon, 13 Dec 2010 19:10:58 +0100 (CET) Received: from [192.168.1.2] (bon31-9-83-155-120-49.fbx.proxad.net [83.155.120.49]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 0E7A9CB027C for ; Mon, 13 Dec 2010 19:10:58 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix debug info for access to unconstrained array types Date: Mon, 13 Dec 2010 19:09:14 +0100 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201012131909.14927.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 adds the missing DWARF entries for access to unconstrained array types when they happen to be frozen before the designated unconstrained array type. Tested on i586-suse-linux, applied on the mainline. 2010-12-13 Eric Botcazou * gcc-interface/decl.c (gnat_to_gnu_entity) : Build a stub DECL for the dummy fat pointer type in the unconstrained array case. * gcc-interface/utils.c (update_pointer_to): Set the DECL_ORIGINAL_TYPE for all the variants in the fat pointer case. Index: gcc-interface/utils.c =================================================================== --- gcc-interface/utils.c (revision 167721) +++ gcc-interface/utils.c (working copy) @@ -3501,15 +3501,16 @@ update_pointer_to (tree old_type, tree n { TYPE_MAIN_VARIANT (t) = new_ptr; SET_TYPE_UNCONSTRAINED_ARRAY (t, new_type); - } - /* And show the original pointer NEW_PTR to the debugger. This is the - counterpart of the equivalent processing in gnat_pushdecl when the - unconstrained array type is frozen after access types to it. */ - if (TYPE_NAME (ptr) && TREE_CODE (TYPE_NAME (ptr)) == TYPE_DECL) - { - DECL_ORIGINAL_TYPE (TYPE_NAME (ptr)) = new_ptr; - DECL_ARTIFICIAL (TYPE_NAME (ptr)) = 0; + /* And show the original pointer NEW_PTR to the debugger. This is + the counterpart of the special processing for fat pointer types + in gnat_pushdecl, but when the unconstrained array type is only + frozen after access types to it. */ + if (TYPE_NAME (t) && TREE_CODE (TYPE_NAME (t)) == TYPE_DECL) + { + DECL_ORIGINAL_TYPE (TYPE_NAME (t)) = new_ptr; + DECL_ARTIFICIAL (TYPE_NAME (t)) = 0; + } } /* Now handle updating the allocation record, what the thin pointer Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 167721) +++ gcc-interface/decl.c (working copy) @@ -3566,6 +3566,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entit TYPE_DUMMY_P (gnu_array_type) = 1; gnu_type = make_node (RECORD_TYPE); + /* Build a stub DECL to trigger the special processing for fat + pointer types in gnat_pushdecl. */ + TYPE_NAME (gnu_type) + = create_type_stub_decl + (create_concat_name (gnat_desig_equiv, "XUP"), gnu_type); SET_TYPE_UNCONSTRAINED_ARRAY (gnu_type, gnu_desig_type); TYPE_POINTER_TO (gnu_desig_type) = gnu_type;