From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 47085 invoked by alias); 29 Aug 2016 19:53:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 47063 invoked by uid 89); 29 Aug 2016 19:53:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=_type, Vectors X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 29 Aug 2016 19:53:38 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 95F4381233; Mon, 29 Aug 2016 19:53:37 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-204-43.brq.redhat.com [10.40.204.43]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u7TJrZar022087 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 29 Aug 2016 15:53:37 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u7TJrYsL008679; Mon, 29 Aug 2016 21:53:34 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u7TJrXbY008678; Mon, 29 Aug 2016 21:53:33 +0200 Date: Mon, 29 Aug 2016 19:53:00 -0000 From: Jakub Jelinek To: Jason Merrill , Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix dwarf2out ARRAY_TYPE handling (PR debug/77363) Message-ID: <20160829195332.GL14857@tucnak.redhat.com> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-08/txt/msg01999.txt.bz2 Hi! In r231058 gen_type_die_with_usage has been changed to treat ARRAY_TYPE like VECTOR_TYPE and not to use type_main_variant in that case. But as the following testcase shows, modified_type_die has similar condition and if those two don't agree, modified_type_die just fails the lookup if type_main_variant (type) != type, and we then fail to add DW_AT_type to the DW_TAG_typedef because of that. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/6.2/5.5? 2016-08-29 Jakub Jelinek PR debug/77363 * dwarf2out.c (modified_type_die): Use lookup_type_die (type) instead of lookup_type_die (type_main_variant (type)) even for array types. * g++.dg/debug/dwarf2/pr77363.C: New test. --- gcc/dwarf2out.c.jj 2016-08-29 12:35:49.000000000 +0200 +++ gcc/dwarf2out.c 2016-08-29 18:05:42.171597789 +0200 @@ -11474,7 +11474,8 @@ modified_type_die (tree type, int cv_qua copy was created to help us keep track of typedef names) and that copy might have a different TYPE_UID from the original ..._TYPE node. */ - if (TREE_CODE (type) != VECTOR_TYPE) + if (TREE_CODE (type) != VECTOR_TYPE + && TREE_CODE (type) != ARRAY_TYPE) return lookup_type_die (type_main_variant (type)); else /* Vectors have the debugging information in the type, --- gcc/testsuite/g++.dg/debug/dwarf2/pr77363.C.jj 2016-08-29 18:26:09.218310766 +0200 +++ gcc/testsuite/g++.dg/debug/dwarf2/pr77363.C 2016-08-29 18:30:03.232579332 +0200 @@ -0,0 +1,20 @@ +// PR debug/77363 +// { dg-options "-gdwarf-2 -dA -fno-merge-debug-strings" } +// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\) DW_TAG_typedef\[^\n\r\]*\[\n\r]*\[^\n\r\]*type2\[^\n\r\]* DW_AT_name\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_line\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_type" } } +// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\) DW_TAG_typedef\[^\n\r\]*\[\n\r]*\[^\n\r\]*type3\[^\n\r\]* DW_AT_name\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_line\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_type" } } +// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\) DW_TAG_typedef\[^\n\r\]*\[\n\r]*\[^\n\r\]*type4\[^\n\r\]* DW_AT_name\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_line\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_type" } } +// { dg-final { scan-assembler "DIE \\(\[^\n\r\]*\\) DW_TAG_typedef\[^\n\r\]*\[\n\r]*\[^\n\r\]*type5\[^\n\r\]* DW_AT_name\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_file\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_decl_line\[^\n\r\]*\[\n\r]*\[^\n\r\]* DW_AT_type" } } + +typedef unsigned short type1; +typedef unsigned char type2; +typedef type2 type3[16]; +typedef unsigned char type4[16]; +typedef struct +{ + struct + { + type3 a; + type4 b; + } c; +} type5; +type5 var; Jakub