From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29237 invoked by alias); 2 May 2012 08:17:12 -0000 Received: (qmail 29221 invoked by uid 22791); 2 May 2012 08:17:08 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-ee0-f73.google.com (HELO mail-ee0-f73.google.com) (74.125.83.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 02 May 2012 08:16:50 +0000 Received: by eeit10 with SMTP id t10so18686eei.0 for ; Wed, 02 May 2012 01:16:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:cc:subject:message-id:date:from:x-gm-message-state; bh=HTCKf0pC9KOqRoWWTGjsXhqUAvb2276XUQyOJa6Fo6g=; b=bQU5Ai2o6ChSBhLnnyLu5n5ErDCtioM+nn8MU25S+R/J073bl7DjPUiQ+x7zCukr5J oM9wgW5gbVndYLeqjbsiKl/shv+Sv53LJAAt1ksyKcvSXwij6dRPJ2emHM79uBsc1LgG O8d6PsJf8OVuwRaTWuYydAQapvu3fJl0EVJ7YaFTEV3WHYjcrEV1eeRCgi13lYPnnQeD FiV+m13ia7WeGrf1suVncOQMDuKGPxseiREHjH745R7VL9GUledFSJkKAfSSoLlMor4K 7z2+q7YVr4LJAIyKcj7mNV5WFqSZQ8zNO6F/beq9TccBDE/XYj55wUUTBx9wBsuJNOQQ QxAg== Received: by 10.14.101.16 with SMTP id a16mr5584217eeg.0.1335946608732; Wed, 02 May 2012 01:16:48 -0700 (PDT) Received: by 10.14.101.16 with SMTP id a16mr5584201eeg.0.1335946608609; Wed, 02 May 2012 01:16:48 -0700 (PDT) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id a14si1161161een.0.2012.05.02.01.16.48 (version=TLSv1/SSLv3 cipher=AES128-SHA); Wed, 02 May 2012 01:16:48 -0700 (PDT) Received: from ruffy2.mtv.corp.google.com (ruffy2.mtv.corp.google.com [172.18.110.129]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id 67CA05C0649; Wed, 2 May 2012 01:16:48 -0700 (PDT) Received: by ruffy2.mtv.corp.google.com (Postfix, from userid 67641) id A1B041E1374; Wed, 2 May 2012 01:16:47 -0700 (PDT) To: sergiodj@redhat.com, tromey@redhat.com, jan.kratochvil@redhat.com cc: gdb-patches@sourceware.org Subject: [RFC] Fix build failure in stap-probe.c. Message-Id: <20120502081647.A1B041E1374@ruffy2.mtv.corp.google.com> Date: Wed, 02 May 2012 08:17:00 -0000 From: dje@google.com (Doug Evans) X-Gm-Message-State: ALoCoQntcQO4SHZimXh6F0Ui5H9DVm8jCoIT9DpXM4dhBsSPEh/G5qb7M6kIphiz0LIjgSfUxlCO2ccmuz5yBylaKh7sEGM6EO+EYaSsujU8LaOqHp0HVbLceIHOIacN9XkkaffK28nWWAQgNvKxbRYPuT3+BG2J6LGI+4g/i3h8GkuWZtD57zk= 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: 2012-05/txt/msg00015.txt.bz2 Hi. I'm getting build failures, gcc is complaining that "opcode" and "lookahead_opcode" "may be used uninitialized". cc1: warnings being treated as errors ../../src/gdb/stap-probe.c: In function 'stap_parse_argument_1': ../../src/gdb/stap-probe.c:1558: error: 'lookahead_opcode' may be used uninitialized in this function ../../src/gdb/stap-probe.c:813: note: 'lookahead_opcode' was declared here ../../src/gdb/stap-probe.c:1558: error: 'opcode' may be used uninitialized in this function ../../src/gdb/stap-probe.c:778: note: 'opcode' was declared here make: *** [stap-probe.o] Error 1 This patch is just RFC. IIUC the code already watches for valid operators before calling stap_get_opcode, so stap_get_opcode should "never" return zero. So I'm wondering if maybe step_get_opcode should be changed to always succeed and always set the opcode. Can one of you look at this? 2012-05-02 Doug Evans * stap-probe.c (stap_parse_argument_1): Fix "may be used uninitialized" build failures. Index: stap-probe.c =================================================================== RCS file: /cvs/src/src/gdb/stap-probe.c,v retrieving revision 1.1 diff -u -p -r1.1 stap-probe.c --- stap-probe.c 27 Apr 2012 20:47:56 -0000 1.1 +++ stap-probe.c 2 May 2012 08:02:24 -0000 @@ -775,7 +775,8 @@ stap_parse_argument_1 (struct stap_parse while (p->arg && *p->arg && *p->arg != ')' && !isspace (*p->arg)) { const char *tmp_exp_buf; - enum exp_opcode opcode; + /* Initialize to pacify gcc. */ + enum exp_opcode opcode = OP_LONG; enum stap_operand_prec cur_prec; if (!stap_is_operator (*p->arg)) @@ -810,7 +811,8 @@ stap_parse_argument_1 (struct stap_parse right-side, but using the current right-side as a left-side. */ while (*p->arg && stap_is_operator (*p->arg)) { - enum exp_opcode lookahead_opcode; + /* Initialize to pacify gcc. */ + enum exp_opcode lookahead_opcode = OP_LONG; enum stap_operand_prec lookahead_prec; /* Saving the current expression buffer position. The explanation