From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8248 invoked by alias); 13 Oct 2011 09:38:26 -0000 Received: (qmail 8136 invoked by uid 22791); 13 Oct 2011 09:38:25 -0000 X-SWARE-Spam-Status: No, hits=-6.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 13 Oct 2011 09:38:03 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9D9c0ZX024671 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 13 Oct 2011 05:38:00 -0400 Received: from host1.jankratochvil.net (ovpn-116-16.ams2.redhat.com [10.36.116.16]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9D9bvio013857 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 13 Oct 2011 05:37:59 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p9D9buJb017002; Thu, 13 Oct 2011 11:37:56 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p9D9btkK016997; Thu, 13 Oct 2011 11:37:55 +0200 Date: Thu, 13 Oct 2011 09:38:00 -0000 From: Jan Kratochvil To: Yao Qi Cc: gdb-patches@sourceware.org Subject: [obv] Fix warning: initialize unused field [Re: [commit] [patch] Fix crash on empty DWARF expressions NULL DATA vs. zero SIZE] Message-ID: <20111013093755.GA14109@host1.jankratochvil.net> References: <20110713160435.GA19359@host1.jankratochvil.net> <20111012220436.GA30417@host1.jankratochvil.net> <4E969B83.1030404@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp Content-Disposition: inline In-Reply-To: <4E969B83.1030404@codesourcery.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00383.txt.bz2 On Thu, 13 Oct 2011 10:04:19 +0200, Yao Qi wrote: > Jan, > This patch causes a build failure, [...] > ../../src/gdb/dwarf2read.c:14204: error: ‘retval.data’ may be used uninitialized in this function Interesting gcc-4.6.1-10.fc16.x86_64 does not give me the error, even with -O2. Checked in. Thanks, Jan http://sourceware.org/ml/gdb-cvs/2011-10/msg00108.html --- src/gdb/ChangeLog 2011/10/13 08:16:42 1.13429 +++ src/gdb/ChangeLog 2011/10/13 09:36:45 1.13430 @@ -1,3 +1,8 @@ +2011-10-13 Jan Kratochvil + + * dwarf2read.c (dwarf2_fetch_die_location_block): Initialize .data even + if .size is 0. + 2011-10-13 Yao Qi PR gdb/12703 --- src/gdb/dwarf2read.c 2011/10/12 22:04:11 1.572 +++ src/gdb/dwarf2read.c 2011/10/13 09:36:47 1.573 @@ -14217,8 +14217,10 @@ attr = dwarf2_attr (die, DW_AT_location, cu); if (!attr) { - /* DWARF: "If there is no such attribute, then there is no effect.". */ + /* DWARF: "If there is no such attribute, then there is no effect.". + DATA is ignored if SIZE is 0. */ + retval.data = NULL; retval.size = 0; } else if (attr_form_is_section_offset (attr))