From patchwork Wed Feb 3 23:37:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 10729 Received: (qmail 8068 invoked by alias); 3 Feb 2016 23:37:33 -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 8058 invoked by uid 89); 3 Feb 2016 23:37:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=411, Hx-languages-length:1558 X-HELO: mail-pf0-f201.google.com Received: from mail-pf0-f201.google.com (HELO mail-pf0-f201.google.com) (209.85.192.201) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 03 Feb 2016 23:37:31 +0000 Received: by mail-pf0-f201.google.com with SMTP id n128so4391256pfn.1 for ; Wed, 03 Feb 2016 15:37:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:message-id:date:subject:from:to :content-type; bh=2ghSd6rPhHQa5bZ1XdZIDjfeAUfFWGCq+Iiidfb0n90=; b=lmeLQbpgS17crhA9XE1SLNrb87n4MszZ4jNezf9FqWHqu6hL+KY43x6hOACbag8OUK HDXmpHSnXdTUItwpDS76tCl9fREbeK5pWb/K3uobivwfH8VZ1Qf1EFVHdaFvtGFz6MXg EDKmwfHHHJR/f0T5HakqZ0gUjY48AatbgAvXoe7/qPtdaGMXjjFqsRRburL0eg3HpX8Y 64uf5VxUiZCQIjD/QektPVnJVxBscjwAhyygTgHrqGnTJ0E43S4P8YvUDP+hz1nbg3ce jeieipXiRrW2dclQoy2sSbrHa1AZCCAUeY6ZsQCKNYNeXbD6vo7O+1wK2QnsPVrY4IrC dRYg== X-Gm-Message-State: AG10YORLT/umDkcVs0ul0KHrh1GCSVuoNUJ/6JUsybErrdUbP9jioxHXsb5MqGyorxtCMeandk1mA2D8FzX7k2eXBDLiB3BvmDLqdT7rpC0cMNQupWBbongeMpxwnwW3bDzfKH9WMlaU9Q/dK72x8FMJT/zzu0EH0ztuzcN0eb0XOK2OYg0Lhw== MIME-Version: 1.0 X-Received: by 10.98.70.130 with SMTP id o2mr4199160pfi.11.1454542649708; Wed, 03 Feb 2016 15:37:29 -0800 (PST) Message-ID: <001a1149af28f2aebb052ae6194e@google.com> Date: Wed, 03 Feb 2016 23:37:29 +0000 Subject: [PATCH] Avoid compilation failure with remote-m32r-sdi.o From: Doug Evans To: gdb-patches@sourceware.org X-IsSubscribed: yes Hi. I'm tripping over this with --enable-targets=all. ../../binutils-gdb/gdb/remote-m32r-sdi.c: In function 'm32r_open': ../../binutils-gdb/gdb/remote-m32r-sdi.c:411:21: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized] max_access_breaks = recv_char_data (); ^ ../../binutils-gdb/gdb/remote-m32r-sdi.c:401:22: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized] max_ib_breakpoints = recv_char_data (); ^ cc1: all warnings being treated as errors The code here isn't checking the return code of recv_data: static unsigned char recv_char_data (void) { unsigned char val = 0; recv_data (&val, 1); return val; } I don't want to spend too much time on this, so for now I'm just fixing the compilation failure. 2016-02-03 Doug Evans * remote-m32r-sdi.c (recv_char_data): Initialize val to avoid compiler warning. (recv_long_data): Ditto. return val; @@ -279,7 +279,7 @@ recv_char_data (void) static unsigned long recv_long_data (void) { - unsigned long val; + unsigned long val = 0; /* -Wall */ recv_data (&val, 4); return ntohl (val); diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index c1bd858..2d3a1ad 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -270,7 +270,7 @@ send_three_arg_cmd (unsigned char cmd, unsigned long arg1, unsigned long arg2, static unsigned char recv_char_data (void) { - unsigned char val; + unsigned char val = 0; /* -Wall */ recv_data (&val, 1);