From patchwork Fri Feb 8 12:10:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Gretton-Dann X-Patchwork-Id: 14697 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 9F3A223E33 for ; Fri, 8 Feb 2013 12:10:24 +0000 (UTC) Received: from mail-vb0-f43.google.com (mail-vb0-f43.google.com [209.85.212.43]) by fiordland.canonical.com (Postfix) with ESMTP id 4AC5DA1996E for ; Fri, 8 Feb 2013 12:10:24 +0000 (UTC) Received: by mail-vb0-f43.google.com with SMTP id fs19so2267468vbb.16 for ; Fri, 08 Feb 2013 04:10:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:message-id:date:from:user-agent :mime-version:to:cc:subject:content-type:x-gm-message-state; bh=9zjAc0vmKak9neLaBzFwIwsSzJEmYjbA0nv9a1Uy2CY=; b=atGitI3/g+jl5lLbp/3T5SQQn8PwnhLDEw5ZBV+qVZQg29rYcmdGd9NRcy1PiP63Qn /eFkrv7weXZ+eciSJZqTokmlObl/7O9osa8GILzXFAnqeHD6r9w6s63+7BBcjHQ2hNty BiV86gVRDyDV8tCqI+FhFLJE5UPpRkuuPH+MbefONqKnuaY2zuBLPYNAtkDmnhT/T64W OZUyTbYwO+CGkcgcDIWq70nxU2MDPetnMnnq3Ey1+VxhSbPVe6R9WPKcdkoj/uP7df8i 00hR/Augfl2NwhKoKDNxcoYSP6VLsd2C4kGurndGOJg+Qi4/NhjArwW1133cNWF93cDW hboQ== X-Received: by 10.52.27.50 with SMTP id q18mr5581192vdg.20.1360325423704; Fri, 08 Feb 2013 04:10:23 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.252.8 with SMTP id zo8csp142277vec; Fri, 8 Feb 2013 04:10:22 -0800 (PST) X-Received: by 10.180.84.131 with SMTP id z3mr2035782wiy.25.1360325421989; Fri, 08 Feb 2013 04:10:21 -0800 (PST) Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com [209.85.212.176]) by mx.google.com with ESMTPS id f1si3187862wie.22.2013.02.08.04.10.20 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 08 Feb 2013 04:10:21 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.176 is neither permitted nor denied by best guess record for domain of matthew.gretton-dann@linaro.org) client-ip=209.85.212.176; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.176 is neither permitted nor denied by best guess record for domain of matthew.gretton-dann@linaro.org) smtp.mail=matthew.gretton-dann@linaro.org Received: by mail-wi0-f176.google.com with SMTP id hm14so745642wib.9 for ; Fri, 08 Feb 2013 04:10:20 -0800 (PST) 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:18 +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 X-Gm-Message-State: ALoCoQnuCv2vs3HSjnUHBxptbp/VCmhSjaa0Wi0XqbgjNDRHuqRwIXp1TT7mdYejCmOKq6qc+o18 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 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;