From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19506 invoked by alias); 9 Mar 2004 20:38:05 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 19499 invoked from network); 9 Mar 2004 20:38:04 -0000 Received: from unknown (HELO localhost.redhat.com) (216.129.200.20) by sources.redhat.com with SMTP; 9 Mar 2004 20:38:04 -0000 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 3578A2B92; Tue, 9 Mar 2004 15:38:04 -0500 (EST) Message-ID: <404E2B2C.8030201@gnu.org> Date: Fri, 19 Mar 2004 00:09:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040217 MIME-Version: 1.0 To: Michael Elizabeth Chastain Cc: gdb-patches@sources.redhat.com, vinschen@redhat.com Subject: Re: [RFC/RFA] gdb.cp/classes.exp: Don't try to print local variable out of scope References: <20040309161507.9FBF54B104@berman.michael-chastain.com> In-Reply-To: <20040309161507.9FBF54B104@berman.michael-chastain.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03/txt/msg00213.txt.bz2 > 1 void foo () > 2 { > 3 int i = 1; > 4 { > 5 int i = 2; > 6 bar(i); > 7 } > 8 bar (i); > 9 } > > cv> Is line 7 still in the scope of the inner definition of variable `i'? > cv> Which `i' should be printed at that point? > > My intuition says that the inner "i" is in scope at line 7. Yes, the inner "i" should be in scope. That line, which hasn't yet been executed, will destory the inner block. I think that is covered by the GCC-O0 rule? Andrew From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19506 invoked by alias); 9 Mar 2004 20:38:05 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 19499 invoked from network); 9 Mar 2004 20:38:04 -0000 Received: from unknown (HELO localhost.redhat.com) (216.129.200.20) by sources.redhat.com with SMTP; 9 Mar 2004 20:38:04 -0000 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 3578A2B92; Tue, 9 Mar 2004 15:38:04 -0500 (EST) Message-ID: <404E2B2C.8030201@gnu.org> Date: Tue, 09 Mar 2004 20:38:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040217 MIME-Version: 1.0 To: Michael Elizabeth Chastain Cc: gdb-patches@sources.redhat.com, vinschen@redhat.com Subject: Re: [RFC/RFA] gdb.cp/classes.exp: Don't try to print local variable out of scope References: <20040309161507.9FBF54B104@berman.michael-chastain.com> In-Reply-To: <20040309161507.9FBF54B104@berman.michael-chastain.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03.o/txt/msg00213.txt Message-ID: <20040309203800.NOe6HrB_UGTJyniAsaU6NJIoD_LBez9kV4At9wugBPA@z> > 1 void foo () > 2 { > 3 int i = 1; > 4 { > 5 int i = 2; > 6 bar(i); > 7 } > 8 bar (i); > 9 } > > cv> Is line 7 still in the scope of the inner definition of variable `i'? > cv> Which `i' should be printed at that point? > > My intuition says that the inner "i" is in scope at line 7. Yes, the inner "i" should be in scope. That line, which hasn't yet been executed, will destory the inner block. I think that is covered by the GCC-O0 rule? Andrew