From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 343 invoked by alias); 8 Feb 2013 12:10:33 -0000 Received: (qmail 312 invoked by uid 22791); 8 Feb 2013 12:10:28 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-we0-f179.google.com (HELO mail-we0-f179.google.com) (74.125.82.179) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 08 Feb 2013 12:10:22 +0000 Received: by mail-we0-f179.google.com with SMTP id x43so3046253wey.10 for ; Fri, 08 Feb 2013 04:10:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:cc :subject:content-type:x-gm-message-state; bh=9zjAc0vmKak9neLaBzFwIwsSzJEmYjbA0nv9a1Uy2CY=; b=SAQYk4FRjt3hdmcekVQI/mQ+wLRuh4szEdmm8Q0yS9LtHgyfAPARj+MipnRFYyn2Dq 0D2xZSlv+HatS5/ut4M88wElNi4Qm3IIpdJYA+Mkim75lcbdDEdQkcTUEYSPQaRqfBv1 bb6yjl67LXV6jHPwZY7Y7W88tNHEdZUlnEvyr2O/GEdmFqDWO4Xnzd7bHtHrRzYUXXGQ +ivRB0GLy7iEHAZgatIbRsRJYjqOSrW3A3lVWKPRLxlAcpkeOvM68zB0Mw0k++HO/hm5 rh8ipHLo4H6i0UUtINEFW+Yy7LCqgFudxLIe24OfUKEle2+/MTZ+Cy6uPBPyZ16NKMNr uyLQ== X-Received: by 10.180.106.231 with SMTP id gx7mr2083211wib.4.1360325420672; Fri, 08 Feb 2013 04:10:20 -0800 (PST) Received: from [172.17.2.133] ([87.115.142.91]) by mx.google.com with ESMTPS id e12sm15075482wiw.5.2013.02.08.04.10.19 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 08 Feb 2013 04:10:19 -0800 (PST) Message-ID: <5114EB2A.9040007@linaro.org> Date: Fri, 08 Feb 2013 12:10:00 -0000 From: Matthew Gretton-Dann User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 MIME-Version: 1.0 To: gdb-patches@sourceware.org CC: Patch Tracking Subject: [RFA] Fix uninitialised variable warning error in gdb/stack.c Content-Type: multipart/mixed; boundary="------------050707060707010008010204" X-Gm-Message-State: ALoCoQlicWg2g2VDPzwhF93KQCTh+DKFR2MS0u7/v197czLG2Shskz7WDT3BfV3g4KASTM8o11kK 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: 2013-02/txt/msg00208.txt.bz2 This is a multi-part message in MIME format. --------------050707060707010008010204 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 940 All, When compiling GDB with GCC 4.5 and earlier I am getting the following uninitialized variable warning: /work/sources/gdb/stack.c: In function 'return_command': /work/sources/gdb/stack.c:2281: error: 'rv_conv' may be used uninitialized in this function make[1]: *** [stack.o] Error 1 make[1]: *** Waiting for unfinished jobs.... make[1]: Leaving directory `/work/builds/common/gdb' The attached patch fixes this issue by initializing rv_conv when it is declared. The value used to initialise rv_conv is chosen so that if the code changes in the future and rv_conv really should be uninitialized then the gdb_assert around line 2385 will trigger. OK for trunk? Tested on x86_64-none-linux-gnu gdb/ChangeLog: 2013-02-08 Matthew Gretton-Dann * stack.c (return_command): Work around uninitialized variable warning. Thanks, Matt -- Matthew Gretton-Dann Toolchain Working Group, Linaro --------------050707060707010008010204 Content-Type: text/plain; charset=UTF-8; name="gdb-stack-c-uninit.txt" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="gdb-stack-c-uninit.txt" Content-length: 492 diff --git a/gdb/stack.c b/gdb/stack.c index 9f4aafc..147d815 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -2278,7 +2278,8 @@ down_command (char *count_exp, int from_tty) void return_command (char *retval_exp, int from_tty) { - enum return_value_convention rv_conv; + /* Initialize it just to avoid a GCC false warning. */ + enum return_value_convention rv_conv = RETURN_VALUE_STRUCT_CONVENTION; struct frame_info *thisframe; struct gdbarch *gdbarch; struct symbol *thisfun; --------------050707060707010008010204--