From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30678 invoked by alias); 20 Jul 2010 06:07:04 -0000 Received: (qmail 30668 invoked by uid 22791); 20 Jul 2010 06:07:03 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mail-pv0-f169.google.com (HELO mail-pv0-f169.google.com) (74.125.83.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 20 Jul 2010 06:06:53 +0000 Received: by pvc30 with SMTP id 30so4953217pvc.0 for ; Mon, 19 Jul 2010 23:06:52 -0700 (PDT) Received: by 10.142.142.12 with SMTP id p12mr7898063wfd.300.1279606012214; Mon, 19 Jul 2010 23:06:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.109.20 with HTTP; Mon, 19 Jul 2010 23:06:32 -0700 (PDT) From: Hui Zhu Date: Tue, 20 Jul 2010 06:07:00 -0000 Message-ID: Subject: [OB] inf-ptrace.c: 'back_to' uninitialized To: gdb-patches ml Content-Type: text/plain; charset=ISO-8859-1 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: 2010-07/txt/msg00293.txt.bz2 Hi, I got: gcc -g -O2 -I. -I../../src/gdb -I../../src/gdb/common -I../../src/gdb/config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I../../src/gdb/../include/opcode -I../../src/gdb/../opcodes/.. -I../../src/gdb/../readline/.. -I../bfd -I../../src/gdb/../bfd -I../../src/gdb/../include -I../libdecnumber -I../../src/gdb/../libdecnumber -I../../src/gdb/gnulib -Ignulib -DMI_OUT=1 -DTUI=1 -DGDBTK -I/usr/include -I/usr/include -Wall -Wdeclaration-after-statement -Wpointer-arith -Wformat-nonliteral -Wno-pointer-sign -Wno-unused -Wunused-value -Wunused-function -Wno-switch -Wno-char-subscripts -Werror -c -o inf-ptrace.o -MT inf-ptrace.o -MMD -MP -MF .deps/inf-ptrace.Tpo ../../src/gdb/inf-ptrace.c cc1: warnings being treated as errors ../../src/gdb/inf-ptrace.c: In function 'inf_ptrace_attach': ../../src/gdb/inf-ptrace.c:208: warning: 'back_to' may be used uninitialized in this function make: *** [inf-ptrace.o] Error 1 I check the inf-ptrace.c found that 'back_to' uninitialized. And it be use inside "if (! ops_already_pushed)" if (! ops_already_pushed) { /* target_pid_to_str already uses the target. Also clear possible core file with its process_stratum. */ push_target (ops); back_to = make_cleanup_unpush_target (ops); } if (! ops_already_pushed) discard_cleanups (back_to); So I checked in the following code to initialize back_to. Thanks, Hui 2010-07-20 Hui Zhu * inf-ptrace.c (inf_ptrace_create_inferior): Initialize back_to. (inf_ptrace_attach): Ditto. =================================================================== RCS file: /cvs/src/src/gdb/inf-ptrace.c,v retrieving revision 1.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- src/gdb/inf-ptrace.c 2010/07/19 17:51:23 1.71 +++ src/gdb/inf-ptrace.c 2010/07/20 05:58:53 1.72 @@ -124,7 +124,7 @@ /* Do not change either targets above or the same target if already present. The reason is the target stack is shared across multiple inferiors. */ int ops_already_pushed = target_is_pushed (ops); - struct cleanup *back_to; + struct cleanup *back_to = NULL; if (! ops_already_pushed) { @@ -205,7 +205,7 @@ /* Do not change either targets above or the same target if already present. The reason is the target stack is shared across multiple inferiors. */ int ops_already_pushed = target_is_pushed (ops); - struct cleanup *back_to; + struct cleanup *back_to = NULL; pid = parse_pid_to_attach (args);