From patchwork Tue Feb 21 19:18:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andreas Arnez X-Patchwork-Id: 19323 Received: (qmail 41709 invoked by alias); 21 Feb 2017 19:18:47 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 41696 invoked by uid 89); 21 Feb 2017 19:18:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=H*o:Research X-HELO: mx0a-001b2d01.pphosted.com Received: from mx0b-001b2d01.pphosted.com (HELO mx0a-001b2d01.pphosted.com) (148.163.158.5) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 Feb 2017 19:18:45 +0000 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v1LJEIXV069757 for ; Tue, 21 Feb 2017 14:18:44 -0500 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 28rm7tdauv-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 21 Feb 2017 14:18:44 -0500 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 21 Feb 2017 19:18:42 -0000 Received: from d06dlp01.portsmouth.uk.ibm.com (9.149.20.13) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 21 Feb 2017 19:18:39 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id D4BA217D8042; Tue, 21 Feb 2017 19:21:48 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1LJIcPZ13697348; Tue, 21 Feb 2017 19:18:38 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2FCEB4C046; Tue, 21 Feb 2017 19:18:27 +0000 (GMT) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 051A44C044; Tue, 21 Feb 2017 19:18:27 +0000 (GMT) Received: from oc1027705133.ibm.com (unknown [9.152.212.222]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 21 Feb 2017 19:18:26 +0000 (GMT) From: Andreas Arnez To: Jan Kratochvil Cc: gdb-patches@sourceware.org, Victor Leschuk Subject: Re: [PATCH v2 4/8] DWARF-5 basic functionality References: <148753968011.4016.6818202131640662529.stgit@host1.jankratochvil.net> <148753970532.4016.14210350935498491454.stgit@host1.jankratochvil.net> Date: Tue, 21 Feb 2017 20:18:36 +0100 In-Reply-To: <148753970532.4016.14210350935498491454.stgit@host1.jankratochvil.net> (Jan Kratochvil's message of "Sun, 19 Feb 2017 22:28:25 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17022119-0020-0000-0000-0000030C6FF1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17022119-0021-0000-0000-0000407B6169 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-21_16:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702210178 X-IsSubscribed: yes On Sun, Feb 19 2017, Jan Kratochvil wrote: [...] > diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c > index a987e0e..063f463 100644 > --- a/gdb/dwarf2read.c > +++ b/gdb/dwarf2read.c [...] > @@ -4699,8 +4775,8 @@ create_debug_type_hash_table (struct dwo_file *dwo_file, > dwo_tu = NULL; > sig_type = OBSTACK_ZALLOC (&objfile->objfile_obstack, > struct signatured_type); > - sig_type->signature = signature; > - sig_type->type_offset_in_tu = type_offset_in_tu; > + sig_type->signature = header.signature; > + sig_type->type_offset_in_tu = header.type_offset_in_tu; > sig_type->per_cu.objfile = objfile; > sig_type->per_cu.is_debug_types = 1; > sig_type->per_cu.section = section; When I compile with "-O3", GCC now yields warnings for the two changed lines above: [...] warning: ‘header.comp_unit_head::type_offset_in_tu.cu_offset::cu_off’ may be used uninitialized in this function [-Wmaybe-uninitialized] sig_type->type_offset_in_tu = header.type_offset_in_tu; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ [...] warning: ‘header.comp_unit_head::signature’ may be used uninitialized in this function [-Wmaybe-uninitialized] sig_type->signature = header.signature; ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~ I *think* GCC is wrong. From what I understand, we can only get here if header.unit_type == DW_UT_type, and then these fields should have been initialized in read_comp_unit_head before (right?). But then I wonder about the effect of the call to create_debug_type_hash_table in create_all_type_units: create_debug_type_hash_table (NULL, &dwarf2_per_objfile->info, types_htab, rcuh_kind::COMPILE); Is that needed? If not, can we drop section_kind as a parameter to create_debug_type_hash_table? When doing so (see untested patch below), the warnings go away. --- Andreas -- >8 -- diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 8a6e1f3..94f5bac 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -4687,8 +4687,7 @@ add_signatured_type_cu_to_table (void **slot, void *datum) static void create_debug_type_hash_table (struct dwo_file *dwo_file, - dwarf2_section_info *section, htab_t &types_htab, - rcuh_kind section_kind) + dwarf2_section_info *section, htab_t &types_htab) { struct objfile *objfile = dwarf2_per_objfile->objfile; struct dwarf2_section_info *abbrev_section; @@ -4735,7 +4734,8 @@ create_debug_type_hash_table (struct dwo_file *dwo_file, table, but we don't need anything else just yet. */ ptr = read_and_check_comp_unit_head (&header, section, - abbrev_section, ptr, section_kind); + abbrev_section, ptr, + rcuh_kind::TYPE); length = get_cu_length (&header); @@ -4847,8 +4847,7 @@ create_debug_types_hash_table (struct dwo_file *dwo_file, for (ix = 0; VEC_iterate (dwarf2_section_info_def, types, ix, section); ++ix) - create_debug_type_hash_table (dwo_file, section, types_htab, - rcuh_kind::TYPE); + create_debug_type_hash_table (dwo_file, section, types_htab); } /* Create the hash table of all entries in the .debug_types section, @@ -4862,8 +4861,6 @@ create_all_type_units (struct objfile *objfile) htab_t types_htab = NULL; struct signatured_type **iter; - create_debug_type_hash_table (NULL, &dwarf2_per_objfile->info, types_htab, - rcuh_kind::COMPILE); create_debug_types_hash_table (NULL, dwarf2_per_objfile->types, types_htab); if (types_htab == NULL) {